i've built a react app in ES6 and created a bundle.js
and anchored it in an HTML page served by django. The app worked fine during development running on the node server, but when the page is served by django linking to the static bundle.js
file, i got the following error:
VM1517:1 Uncaught Error: Cannot find module "./src/index.js"
note that index.js
is the entry point of this react app. any help is appreciated! thanks!
the webpack.config.js
is below:
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: __dirname,
publicPath: '/',
filename: 'bundle.js'
},
module: {
loaders: [{
exclude: /node_modules/,
loader: 'babel'
}]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
devServer: {
contentBase: './'
}
};
UPDATE: @kaylus the result of running webpack is below:
ERROR in ./src/index.js
Module build failed: SyntaxError: Unexpected token (137:12)
135 | render() {
136 | return (
> 137 | <div className='container'>
UPDATE: i solved this issue by following @Kaylus's link to this post https://stackoverflow.com/a/33460642/3974213