Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hard source webpack plugin in experimental speed mode #404

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"file-loader": "2.0.0",
"globby": "7.1.1",
"gzip-size": "4.1.0",
"hard-source-webpack-plugin": "0.13.1",
"html-loader": "0.5.5",
"html-webpack-plugin": "3.2.0",
"http-proxy-middleware": "^0.19.0",
Expand Down
18 changes: 18 additions & 0 deletions src/base.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
const createHash = require('webpack/lib/util/createHash');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');

const stylelint = require('stylelint');
const StyleLintPlugin = require('stylelint-webpack-plugin');
Expand Down Expand Up @@ -457,6 +458,23 @@ export default function webpackConfigFactory(args: any): webpack.Configuration {
devtool: 'source-map',
watchOptions: { ignored: /node_modules/ },
plugins: removeEmpty([
isExperimentalSpeed &&
new HardSourceWebpackPlugin({
info: {
level: 'warn'
}
}),
isExperimentalSpeed &&
new HardSourceWebpackPlugin.ExcludeModulePlugin([
{
// HardSource works with mini-css-extract-plugin but due to how
// mini-css emits assets, assets are not emitted on repeated builds with
// mini-css and hard-source together. Ignoring the mini-css loader
// modules, but not the other css loader modules, excludes the modules
// that mini-css needs rebuilt to output assets every time.
test: /mini-css-extract-plugin[\\/]dist[\\/]loader/
}
]),
new StyleLintPlugin({
config: {
rules: {
Expand Down