Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript支持的问题 #6

Closed
xuming314 opened this issue Nov 29, 2017 · 1 comment
Closed

typescript支持的问题 #6

xuming314 opened this issue Nov 29, 2017 · 1 comment

Comments

@xuming314
Copy link

xuming314 commented Nov 29, 2017

设置脚本后缀支持.ts文件:new WXAppWebpackPlugin({clear:!isDev, scriptExt:'.ts'})
但entry里还是必须设置app.js为.js后缀:entry: {app: [ './src/app.js']}
问题在以下源代码,写死了app.js:(建议支持动态options.scriptExt)
const getEntryFromCompiler = () => {
if (typeof entry === 'string') return entry;
const appJSRegExp = /\bapp(.js)?$/;
const findAppJS = arr => arr.find(path => appJSRegExp.test(path));
if (Array.isArray(entry)) return findAppJS(entry);
if (typeof entry === 'object') {
for (const key in entry) {
if (!entry.hasOwnProperty(key)) continue;
const val = entry[key];
if (typeof val === 'string') return val;
if (Array.isArray(val)) return findAppJS(val);
}
}
};

@Cap32
Copy link
Owner

Cap32 commented Dec 2, 2017

v0.17 57650a3 解决了这个问题,已发布到 npm。

新增 extensions 配置选项,通过配置 extensions: ['.ts', '.js'] 可以实现。

感谢反馈 👍🏿

@Cap32 Cap32 closed this as completed Dec 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants