Levi Botelho
Levi Botelho

Reputation: 25214

Webpack not uglifying/minifying

I'm using Webpack to build my site, but despite including the UglifyJsPlugin in the config, the output doesn't minify.

{
    entry: "./dist/client/js/index.js",
    devtool: "source-map",
    loaders: [
        {
            test: /\.js$/,
            loader: "babel",
            query: {
                cacheDirectory: false
            }
        }
    ],
    module: {
        preLoaders: [
            {
                test: /client\\.*\.js$/,
                loader: "source-map-loader"
            }
        ]
    },
    node: {
        child_process: "empty",
        dns: "empty",
        fs: "empty",
        net: "empty"
    },
    output: {
        path: JS_CLIENT_BUILD_PATH,
        filename: JS_BUNDLE_NAME
    },
    plugins: [new webpack.optimize.UglifyJsPlugin()]
}

Any ideas as to what I might be doing wrong?

Upvotes: 1

Views: 2627

Answers (1)

cgatian
cgatian

Reputation: 22994

I would try running webpack from the CLI with the -p argument. This essentially adds the Uglify plugin and sets the debug value to false. This should also minify the output. If the output is minified I would then point to something incorrect in your configuration.

Upvotes: 2

Related Questions