DEV Community

loading...

Customize Angular Webpack config

Don
・1 min read
  1. add customWebpackConfig to angular.json

    {
        "projects": {
            "architect": {
                "build": {
                    "options": {
                      "customWebpackConfig": {
              "path": "./custom-webpack.config.js",
              "replaceDuplicatePlugins": true
            },
                    }
                }
            }
        }
    }
    
  2. add the extra webpack plugin config in the custom-webpack.config.js

    module.exports = {
        module: {
            rules: [
                {
                    test: /\.js$/,
                    loader: 'babel-loader',
                    query: {
                        presets: ['@babel/preset-env'
                        ]
                    }
                }
            ]
        }
    }
    
    

Discussion (0)