0

I am getting following error in my file. I don't have any reference to 'env' for webpack still giving following error

[ERROR] [webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. [ERROR] - configuration has an unknown property 'env'. These properties are valid: [ERROR] object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, experiments?, extends?, externals?, externalsPresets?, externalsType?, ignoreWarnings?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, snapshot?, stats?, target?, watch?, watchOptions? } [ERROR] -> Options object as provided by the user. [ERROR] For typos: please correct them. [ERROR] For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration. [ERROR] Loaders should be updated to allow passing options via loader options in module.rules. [ERROR] Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader: [ERROR] plugins: [ [ERROR] new webpack.LoaderOptionsPlugin({ [ERROR] // test: /.xxx$/, // may apply this only for some modules [ERROR] options: { [ERROR] env: รข?? [ERROR] } [ERROR] }) [ERROR] ]

const UglifyJsPlugin = require('uglify-js-plugin');

const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const cssnano = require('cssnano');

const commonConfig = require('./webpack.common'); const helpers = require('./helpers');

module.exports = mergeWithCustomize(commonConfig, { mode: 'production',

output: {
    path: helpers.root('dist/bundles'),
    filename: '[name].bundle.js'
},

optimization: {
    noEmitOnErrors: true,
    splitChunks: {
        chunks: 'all'
    },
    runtimeChunk: 'single',
    minimizer: [
        new UglifyJsPlugin({
            cache: true,
            parallel: true
        }),

        new OptimizeCSSAssetsPlugin({
            cssProcessor: cssnano,
            cssProcessorOptions: {
                discardComments: {
                    removeAll: true
                }
            },
            canPrint: false
        })
    ]
},

module: {
    rules: [
        {
            test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
            // loader: '@artonge/webpack'
            loader: '@ngtools/webpack'
        }
    ]
},
plugins: [
    new AngularWebpackPlugin({
        tsConfigPath: 'tsconfig.json',
        entryModules: ['./src/a-app/a-app.module#AAppModule', './src/a-app-sample/a-app-sample.module#SampleModule']
    })
]

});

User2
  • 1,293
  • 8
  • 17

0 Answers0