Skip to content

Commit

Permalink
Scripts: Clean up the build folder via clean-webpack-plugin (#23135)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean90 authored Jun 15, 2020
1 parent 567b159 commit 6d1c6ef
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 0 deletions.
112 changes: 112 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 packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
### Bug Fixes

- Update webpack configuration to not run the Sass loader on CSS files. It's now limited to .scss and .sass files.
- During rebuilds, all webpack assets that are not used anymore will be removed automatically.
- Fix broken `style.(sc|sa|c)ss` handling in the `build` and `start` scripts ([#23127](https://github.com/WordPress/gutenberg/pull/23127)).

## 10.0.0 (2020-05-28)
Expand Down
4 changes: 4 additions & 0 deletions packages/scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const { BundleAnalyzerPlugin } = require( 'webpack-bundle-analyzer' );
const LiveReloadPlugin = require( 'webpack-livereload-plugin' );
const MiniCSSExtractPlugin = require( 'mini-css-extract-plugin' );
const { CleanWebpackPlugin } = require( 'clean-webpack-plugin' );
const path = require( 'path' );

/**
Expand Down Expand Up @@ -131,6 +132,9 @@ const config = {
],
},
plugins: [
// During rebuilds, all webpack assets that are not used anymore
// will be removed automatically.
new CleanWebpackPlugin(),
// The WP_BUNDLE_ANALYZER global variable enables a utility that represents
// bundle content as a convenient interactive zoomable treemap.
process.env.WP_BUNDLE_ANALYZER && new BundleAnalyzerPlugin(),
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"babel-loader": "^8.1.0",
"chalk": "^4.0.0",
"check-node-version": "^3.1.1",
"clean-webpack-plugin": "^3.0.0",
"cross-spawn": "^5.1.0",
"css-loader": "^3.5.2",
"dir-glob": "^3.0.1",
Expand Down

0 comments on commit 6d1c6ef

Please sign in to comment.