A
A
Arthur2017-04-02 22:44:18
webpack
Arthur, 2017-04-02 22:44:18

How to specify JS-only output path in Webpack?

webpack.config.js

module.exports = {
...
    entry: {
        'js/main' : './main',
        'js/common' : './common' //CommonChunksPlugin
    },
...
}

if(Settings.jsUglify){
    module.exports.plugins.push(
        new webpack.optimize.UglifyJsPlugin({
            compress : {
                warnings : false,
                drop_console: true,
                unsafe: true
            }
        })
    );
}

The problem is this: when building with CommonChunkPlugin, a js file variable is created, i.e. my entry config creates an output variable:
var js/main = ...
This is a js bug and uglify can't minify the code.
If my entry looks like this, then there is no problem:
module.exports = {
...
    entry: {
        'main' : './main',
        'common' : './common' //CommonChunksPlugin
    },
...

How can I set a separate directory for the collected JS files?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question