I get this error when running build after migration, and not sure if it can't recognise tsx files or something inside of tsx file that it doesn't like:
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
Content of 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:}
My webpack config after migration script:
not sure if it can't recognise tsx files or something inside of tsx file that it doesn't like
Doesn't recognize tsx.
I would change
{
test: /\.(ts|tsx)$/,
include: paths.appSrc,
use: [{
loader: 'ts-loader'
}],
}
To standard docs : https://webpack.js.org/guides/webpack-and-typescript/
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [ 'ts-loader' ]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.