Skip to content

Instantly share code, notes, and snippets.

@kenmori

kenmori/webpack.config.js

Last active Dec 27, 2016
Embed
What would you like to do?
【React】これ。SyntaxError: 'import' and 'export' may only appear at the top level
///webpack.config.js変更前/////
module: {
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/,
loaders: ['react-hot']
}
]
},
///変更後////
//add 'babel?presets[]=es2015&presets[]=react'
//if you not yet install npmpackage, npm i -D babel-preset-es2015 babel-preset-react
module: {
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/,
loaders: ['react-hot', 'babel?presets[]=es2015&presets[]=react']
}
]
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment