2017-05-29 3 views
1

Ich bekomme diesen Fehler beim Ausführen von Build nach der Migration, und nicht sicher, ob es TSX-Dateien oder etwas in der TSX-Datei, die es nicht mag nicht erkennen kann :Migrate von webpack v1 zu v2 mit webpack-cli erzeugt Fehler für 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

Inhalt des 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:} 

Meine webpack Config nach der Migration Skript:

https://pastebin.com/KX02ZRUY

Antwort

0

not sure if it can't recognise tsx files or something inside of tsx file that it doesn't like

TSX wird nicht erkannt.

würde ich

{ 
     test: /\.(ts|tsx)$/, 
     include: paths.appSrc, 
     use: [{ 
      loader: 'ts-loader' 
     }], 
    } 

Zur Standard-Dokumentation ändern: https://webpack.js.org/guides/webpack-and-typescript/

{ 
    test: /\.tsx?$/, 
    exclude: /node_modules/, 
    use: [ 'ts-loader' ] 
} 
Verwandte Themen