Closed gajus closed 7 years ago
@gajus Yes, it optimizes the whole bundle, after Webpack puts everything together.
Just wanted to point out, in case anyone else stumbles to this issue many moons later, that because the plugin passes its options
hash to Webpack's ModuleFilenameHelpers
, one can in fact exclude files and patterns from optimization:
new ClosureCompilerPlugin({
compiler: {
charset: 'UTF-8',
compilation_level: 'SIMPLE',
formatting: 'SINGLE_QUOTES',
language_in: 'ECMASCRIPT5',
language_out: 'ECMASCRIPT5',
warning_level: 'QUIET'
},
concurrency: 3,
exclude: [
/bluebird/
]
})
The only caveat is that the match is made against the final built chunk name, not the name of the input module, so it's sometimes necessary to do a little dance to segment off the code you want to protect.
Our webpack bundle imports external scripts that we do not have control over. Is there a way to tell
webpack-closure-compiler
not to minify certain files, or doeswebpack-closure-compiler
operate on the resulting bundle level?