Answer the question
In order to leave comments, you need to log in
Why is there a Module parse failed error in webpack?
An error occurs.
``ERROR in ./jsx/app.jsx
Module parse failed: C:\ProjectCourse\здесь путь Unexpected token (6:7)
You may need an appropriate loader to handle this file type.
| import {articles} from './fixtures.js'
|
| render(<Article />, document.getElementById('container'))
| /*article = {articles[0]}*/
@ multi ./jsx/app.jsx``
var path = require('path')
module.exports = {
devtool: 'source-map',
entry: [
'./jsx/app.jsx'
],
output: {
path: path.join(__dirname, 'build'),
filename: 'bundle.js',
publicPath: '/build/'
},
devServer: {
proxy: [{
path: '/api/',
target: 'http://localhost:3001'
}],
historyApiFallback: true
},
module: {
loaders: [
{
test: /\.js/,
loaders: ['babel-loader'],
include: path.join(__dirname, 'src')
},
{
test: /\.css/,
loaders: ['style-loader', 'css-loader'],
}
]
}
}
Answer the question
In order to leave comments, you need to log in
test: /\.js[x]?$/,
UPD: you have entry './jsx/app.jsx'
, but include . Carry the include. And use only the latest versions of libraries in projects. The current major version of Webpack is 4. path.join(__dirname, 'src')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question