I ran webpack for the first tutorial I encountered this issue: $ webpack Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.module has an unknown property 'loaders'. These properties are valid: object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? } -> Options affecting the normal modules (`NormalModuleFactory`). From https://github.com/serverless/serverless/issues/4788 Fixed by changing loaders to rules in webpack.config.js But then saving and running webpack again I encountered another issue. ERROR in ./js/client.js Module build failed (from ../node_modules/babel-loader/lib/index.js): TypeError: Cannot read property 'babel' of undefined at Object.module.exports (\<skip>..\react-js-tutorials\1-basic-react\node_modules\babel-loader\lib\index.js:103:36) Hope you can help me on this thanks!
Activity
imsamdez commentedon Jul 22, 2018
Here is an updated version of the
modulepart of thewebpack.config.js. You may need to change it according to your needs. It used Webpack 4.jannovergara commentedon Jul 27, 2018
Apparently I was able to make a workaround with this:
module: {
rules: [
{
test: /.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /.css$/,
use: ["style-loader", "css-loader"]
}
]
},
But thanks for the reply! Appreciate much.
moonlight16 commentedon Oct 18, 2018
At first I was getting this error:
Then after following @sdubrez suggested changes here, now I'm getting this error:
This is following the code in 1-basic-react tutorial