fast-css-split-webpack-plugin
Advanced tools
Comparing version 1.0.3 to 1.0.4
1.0.4 / 2018-05-08 | ||
================== | ||
* feat: support webpack 4 | ||
* chore: bump to 1.0.4 | ||
1.0.3 / 2018-04-27 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -198,17 +198,39 @@ 'use strict' | ||
apply (compiler) { | ||
if (this.options.defer) { | ||
// Run on `emit` when user specifies the compiler phase | ||
// Due to the incorrect css split + optimization behavior | ||
// Expected: css split should happen after optimization | ||
compiler.plugin('emit', (compilation, done) => { | ||
return this.chunksMapping(compilation, compilation.chunks, done) | ||
}) | ||
// for webpack 4 | ||
if (compiler.hooks) { | ||
const plugin = { | ||
name: 'FastCssSplitPlugin' | ||
} | ||
if (this.options.defer) { | ||
// Run on `emit` when user specifies the compiler phase | ||
// Due to the incorrect css split + optimization behavior | ||
// Expected: css split should happen after optimization | ||
compiler.hooks.emit.tapAsync(plugin, (compilation, done) => { | ||
this.chunksMapping(compilation, compilation.chunks, done) | ||
}) | ||
} else { | ||
// use compilation instead of this-compilation, just like other plugins do | ||
compiler.hooks.compilation.tap(plugin, compilation => { | ||
compilation.hooks.optimizeChunkAssets.tapAsync(plugin, (chunks, done) => { | ||
this.chunksMapping(compilation, chunks, done) | ||
}) | ||
}) | ||
} | ||
} else { | ||
// Only run on `this-compilation` to avoid injecting the plugin into | ||
// sub-compilers as happens when using the `extract-text-webpack-plugin`. | ||
compiler.plugin('this-compilation', (compilation) => { | ||
compilation.plugin('optimize-chunk-assets', (chunks, done) => { | ||
return this.chunksMapping(compilation, chunks, done) | ||
if (this.options.defer) { | ||
// Run on `emit` when user specifies the compiler phase | ||
// Due to the incorrect css split + optimization behavior | ||
// Expected: css split should happen after optimization | ||
compiler.plugin('emit', (compilation, done) => { | ||
return this.chunksMapping(compilation, compilation.chunks, done) | ||
}) | ||
}) | ||
} else { | ||
// use compilation instead of this-compilation, just like other plugins do | ||
compiler.plugin('compilation', (compilation) => { | ||
compilation.plugin('optimize-chunk-assets', (chunks, done) => { | ||
return this.chunksMapping(compilation, chunks, done) | ||
}) | ||
}) | ||
} | ||
} | ||
@@ -215,0 +237,0 @@ } |
{ | ||
"name": "fast-css-split-webpack-plugin", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"author": "yibn2008 <yibn2008@qq.com>", | ||
@@ -5,0 +5,0 @@ "license": "CC0-1.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23038
453