Source maps in webpack compiler + closures

I would like to use the SourceMaps generated by the Closure Compiler using Webpack, but I cannot figure out how to do this.

Here is my webpack configurator:

const ClosureCompiler = require('google-closure-compiler-js').webpack;

module.exports = {
    devtool: 'source-map',
    entry: './src/app.js',
    output: {
        path: __dirname + "/build/",
        filename: "bundle.js",
        //sourceMapFilename: "./app.js.map",
    },
    plugins: [
        new ClosureCompiler({
            compiler: {
                language_in: 'ECMASCRIPT5',
                language_out: 'ECMASCRIPT5',
                compilation_level: 'ADVANCED',
                create_source_map: __dirname + './output.js.map'
            },
            concurrency: 3,
        })
    ]
};

When I start webpack, nothing happens. What for? What am I doing wrong? Thank you for your help.

+4
source share
1 answer

Using the latest version of google-clos-compiler-js ( 20170910.0.1), I was able to get it working using the following options:

plugins: [
  new ClosureCompiler({
    options: {
      languageIn: 'ECMASCRIPT6',
      languageOut: 'ECMASCRIPT5',
      compilationLevel: 'ADVANCED',
      createSourceMap: true
    }
  })
]
0
source

Source: https://habr.com/ru/post/1679013/


All Articles