Answer the question
In order to leave comments, you need to log in
Pug and WebPack not working?
Hello. The problem is this...
I have my webpack config, here is the code:
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/joker/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, '../dist/joker')
},
resolve: {
alias: {
'@': '../src',
'@joker': '../src/joker/js'
}
},
loaders: [
{
test: /\.pug$/,
include: path.join(__dirname, '../src/joker/pug/'),
loaders: [ 'pug-loader' ]
}
],
plugins: [
new HtmlWebpackPlugin({
template : './index.pug',
inject : true
}),
new HtmlWebpackPlugin()
]
};
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'loaders'. These properties are valid:
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, externals?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, serve?, stats?, target?, watch?, watchOptions? }
For typos: please correct them.
For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin({
// test: /\.xxx$/, // may apply this only for some modules
options: {
loaders: …
}
})
]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected]1.0.0 start: `npx webpack --config ./configs/webpack.config.js --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected]1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Администратор\AppData\Roaming\npm-cache\_logs\2019-04-04T09_54_25_026Z-debug.log
Answer the question
In order to leave comments, you need to log in
Crap,
loaders:Seriously?
module: {
rules: [
{
test: /\.pug$/,
include: path.join(__dirname, '../src/joker/pug/'),
loaders: [ 'pug-loader' ]
}
],
}
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration has an unknown property 'loaders'.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question