迁移后运行构建时出现此错误,并且不确定它是否无法识别tsx文件或其不喜欢的tsx文件:使用webpack-cli从webpack v1迁移到v2会产生tsx的错误
Failed to compile. Error in ./src/index_app.tsx Module parse failed: /src/index_app.tsx Unexpected token (17:26) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (17:26) @ multi main
内容index_app.tsx的:
17:const rootReducer = (state:any, action:any) => {
18: if (action.type === Actions.RESET_GLOBAL_STATE) {
19: state = undefined;
20: }
21: return reducers(state, action)
22:}
迁移脚本后,我的WebPack配置: