Answer the question
In order to leave comments, you need to log in
Does Webpack give a strange error when building?
Hello. I started learning Webpack based on Ilya Kantor's screencast. When I added the resolve and resolveLoader settings in the webpack.config.js file, and ran the webpack command, I got an error message that I can't overcome in any way:
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.resolve has an unknown property 'modulesDirectories'. These properties are valid:
object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
- configuration.resolve.extensions[0] should not be empty.
- configuration.resolveLoader has an unknown property 'moduleTemplates'. These properties are valid:
object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
- configuration.resolveLoader.extensions[0] should not be empty.
var webpack = require('webpack');
var NODE_ENV = process.env.NODE_ENV || 'development';
module.exports = {
entry: "./js/main",
output: {
filename: "js/build.js",
library: 'main'
},
watch: NODE_ENV == 'development',
watchOptions: {
aggregateTimeout: 100
},
devtool: NODE_ENV == 'development' ? 'cheap-inline-module-source-map' : null,
plugins: [
new webpack.DefinePlugin({
NODE_ENV: JSON.stringify(NODE_ENV),
LANG: JSON.stringify('ru')
})
],
resolve: {
modulesDirectories: ['node_modules'],
extensions: ['', '.js']
},
resolveLoader: {
modulesDirectories: ['node_modules'],
moduleTemplates: ['*-loader'],
extensions: ['', '.js']
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel'
}
]
}
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question