From 5fadceda9277cb9d9612aa439da85d06a83da032 Mon Sep 17 00:00:00 2001 From: Cong Cuong PHAM Date: Fri, 13 Oct 2017 12:18:01 +0200 Subject: [PATCH] change local settings of webpack to fix error 'Module build failed: SyntaxError: Unexpected token (9:6)' ref: https://stackoverflow.com/questions/33460420/babel-loader-jsx-syntaxerror-unexpected-token?answertab=votes#tab-top --- django/webpack.local.config.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/django/webpack.local.config.js b/django/webpack.local.config.js index 2f654a5..19ad351 100644 --- a/django/webpack.local.config.js +++ b/django/webpack.local.config.js @@ -11,7 +11,15 @@ config.plugins = config.plugins.concat([ ]) config.module.loaders.push( - { test: /\.jsx?$/, exclude: /node_modules/, loaders: ['react-hot', 'babel'] } + { + test: /\.jsx?$/, // Match both .js and .jsx files + exclude: /node_modules/, + loader: "babel", + query: + { + presets:['react'] + } + } ) module.exports = config