Webpack schema not validating correctly

Hello, I am using webpack 4.41.6, and WebStorm 2019.3 and when I set up the config file  like this:

optimization: {
splitChunks: {
cacheGroups: {
vendors: {
test : /node_modules/,
name : 'vendor',
chunks: 'all'
}
}
}
},

I get an error that is being validated against the "not" schema of webpack:

https://github.com/webpack/webpack/blob/master/schemas/WebpackOptions.json#L1445

However, checking it does not seem to match the "not" part of the webschema, since it requires a test property in cachegroups, that my config file does not have, so I am assuming this is some kind of error with WebStorm schema validation.

0
7 comments

I don't have any issues reported when using similar configuration (with

"webpack": "4.41.6"

):

Please share your webpack configuration file

0
Avatar
Permanently deleted user

0

Please share a file itself, not a screenshot

1
Avatar
Permanently deleted user

Sorry about that, this is my webpack file:

const webpack = require( 'webpack' );
const HtmlWebpackPlugin = require( 'html-webpack-plugin' );
const { CleanWebpackPlugin } = require( 'clean-webpack-plugin' );
const WebpackChunkHash = require( 'webpack-chunk-hash' );
const LodashModuleReplacementPlugin = require( 'lodash-webpack-plugin' );
const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
const SWPrecacheWebpackPlugin = require( 'sw-precache-webpack-plugin' );
const packageJson = require( '../package.json' );

module.exports = {
entry : [ '@babel/polyfill', './src/index.js' ],
output: {
filename: '[name].[chunkhash].js'
},
devServer: {
host : '0.0.0.0',
disableHostCheck: true
},
resolve: {
modules: [ 'node_modules' ]
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test : /@harmony/,
name : 'harmony',
chunks: 'all'
},
vendors: {
test : /node_modules/,
name : 'vendor',
chunks: 'all'
}
}
}
},
module: {
rules: [
{
test : /\.js$/,
exclude: /(node_modules)/,
use : [
{
loader : 'babel-loader',
options: {
plugins: [ 'lodash' ],
presets: [ '@babel/preset-env' ]
}
}
]
},
{
test: /\.(png|jpg)/,
use : [ 'file-loader' ]
},
{
test: /\.(woff|woff2|eot|ttf|otf)/,
use : [ 'file-loader' ]
},
{
test: /\.(glsl|vert|frag)/,
use : [ 'raw-loader' ]
}
]
},
plugins: [
new CleanWebpackPlugin( {
cleanStaleWebpackAssets: false
} ),
new webpack.DefinePlugin( {
'VERSION': JSON.stringify( packageJson.version )
} ),
new webpack.ProvidePlugin( {
PIXI: 'pixi.js-legacy'
} ),
new CopyWebpackPlugin( [ {
from: './src/assets/spines',
to : './assets/spines'
} ] ),
new CopyWebpackPlugin( [ {
from: './src/assets/sprites/dist',
to : './assets/sprites/dist'
} ] ),
new CopyWebpackPlugin( [ {
from: './src/assets/icons',
to : './assets/icons'
} ] ),
new CopyWebpackPlugin( [ {
from: './src/assets/languages',
to : './assets/languages'
} ] ),
new CopyWebpackPlugin( [ {
from: './src/assets/sounds/dist',
to : './assets/sounds/dist'
} ] ),
new CopyWebpackPlugin( [ {
from: './src/assets/fonts',
to : './assets/fonts'
} ] ),
new CopyWebpackPlugin( [ {
from: './manifest.json',
to : './manifest.json'
} ] ),
new CopyWebpackPlugin( [ {
from: './favicon.ico',
to : './favicon.ico'
} ] ),
new WebpackChunkHash( { algorithm: 'md5' } ),
new LodashModuleReplacementPlugin(),
new webpack.HashedModuleIdsPlugin(),
new HtmlWebpackPlugin( {
title : packageJson.name,
template: 'index.ejs'
} ),
new SWPrecacheWebpackPlugin(
{
cacheId : `${packageJson.id}-${packageJson.version}`,
minify : true,
staticFileGlobsIgnorePatterns: [ /index\.html/, /manifest\.json/, /favicon\.ico/ ]
}
)
]
};
0

thank you! still no luck in reproducing the issue (checked in 2019.3.3 and 2020.1 EAP):

Did you try invalidating caches (File > Invalidate caches, Invalidate and Restart)? Can you reproduce the issue in a new project?

0

What IDE version do you use? looks similar to https://youtrack.jetbrains.com/issue/WEB-43117, that is fixed in 2019.3.2

0
Avatar
Permanently deleted user

Hello, updating it to 2019.3.3 seems to have fixed it! Thanks

1

Please sign in to leave a comment.