-
-
Notifications
You must be signed in to change notification settings - Fork 201
Update Webpack to v5 (+ other dependencies) #645
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
Changes from all commits
f3843ca
8da531e
564b147
1d22520
50cea18
9af90ee
4f6171b
b0f7190
d576b21
b292e76
444c37f
ddcd6d8
216a5ca
8d7843a
57f64fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,25 +192,22 @@ class Encore { | |
} | ||
|
||
/** | ||
* Allows you to configure the options passed to the optimize-css-assets-webpack-plugin. | ||
* A list of available options can be found at https://github.com/NMFR/optimize-css-assets-webpack-plugin | ||
* Allows you to configure the options passed to the css-minimizer-webpack-plugin. | ||
* A list of available options can be found at https://github.com/webpack-contrib/css-minimizer-webpack-plugin | ||
* | ||
* For example: | ||
* | ||
* ``` | ||
* Encore.configureOptimizeCssPlugin((options) => { | ||
* options.cssProcessor = require('cssnano'); | ||
* options.cssProcessorPluginOptions = { | ||
* preset: ['default', { discardComments: { removeAll: true } }], | ||
* } | ||
* Encore.configureCssMinimizerPlugin((options) => { | ||
* options.parallel = false; | ||
* }) | ||
* ``` | ||
* | ||
* @param {function} optimizeCssPluginOptionsCallback | ||
* @param {function} cssMinimizerPluginOptionsCallback | ||
* @returns {Encore} | ||
*/ | ||
configureOptimizeCssPlugin(optimizeCssPluginOptionsCallback = () => {}) { | ||
webpackConfig.configureOptimizeCssPlugin(optimizeCssPluginOptionsCallback); | ||
configureCssMinimizerPlugin(cssMinimizerPluginOptionsCallback = () => {}) { | ||
webpackConfig.configureCssMinimizerPlugin(cssMinimizerPluginOptionsCallback); | ||
|
||
return this; | ||
} | ||
|
@@ -454,28 +451,6 @@ class Encore { | |
return this; | ||
} | ||
|
||
/** | ||
* Add a "commons" file that holds JS shared by multiple chunks/files. | ||
* | ||
* For example: | ||
* | ||
* ``` | ||
* Encore.createSharedEntry( | ||
* 'vendor', | ||
* './src/shared.js' | ||
* ); | ||
* ``` | ||
* | ||
* @param {string} name The chunk name (e.g. vendor to create a vendor.js) | ||
* @param {string} file A file whose code & imports should be put into the shared file. | ||
* @returns {Encore} | ||
*/ | ||
createSharedEntry(name, file) { | ||
webpackConfig.createSharedEntry(name, file); | ||
|
||
return this; | ||
} | ||
|
||
/** | ||
* Add a new cache group to Webpack's SplitChunksPlugin. | ||
* This can, for instance, be used to extract code that | ||
|
@@ -1030,6 +1005,34 @@ class Encore { | |
return this; | ||
} | ||
|
||
/** | ||
* Configure the mini-css-extract-plugin. | ||
* | ||
* https://github.com/webpack-contrib/mini-css-extract-plugin#configuration | ||
* | ||
* ``` | ||
* Encore.configureMiniCssExtractPlugin( | ||
* function(loaderConfig) { | ||
* // change the loader's config | ||
* // loaderConfig.reloadAll = true; | ||
* }, | ||
* function(pluginConfig) { | ||
* // change the plugin's config | ||
* // pluginConfig.chunkFilename = '[id].css'; | ||
* } | ||
* ); | ||
* ``` | ||
* | ||
* @param {function} loaderOptionsCallback | ||
* @param {function} pluginOptionsCallback | ||
* @returns {Encore} | ||
*/ | ||
configureMiniCssExtractPlugin(loaderOptionsCallback, pluginOptionsCallback = () => {}) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be bundled in the webpack 5 upgrade, or be submitted separately ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I originally added it into #564 in case people wanted to disable the new |
||
webpackConfig.configureMiniCssExtractPlugin(loaderOptionsCallback, pluginOptionsCallback); | ||
|
||
return this; | ||
} | ||
|
||
/** | ||
* If enabled, the react preset is added to Babel. | ||
* | ||
|
@@ -1634,38 +1637,6 @@ class Encore { | |
runtimeConfig = null; | ||
webpackConfig = null; | ||
} | ||
|
||
/** | ||
* @deprecated | ||
* @return {void} | ||
*/ | ||
configureExtractTextPlugin() { | ||
throw new Error('The configureExtractTextPlugin() method was removed from Encore. The underlying plugin was removed from Webpack 4.'); | ||
} | ||
|
||
/** | ||
* @deprecated | ||
* @return {void} | ||
*/ | ||
enableCoffeeScriptLoader() { | ||
throw new Error('The enableCoffeeScriptLoader() method and CoffeeScript support was removed from Encore due to support problems with Webpack 4. If you are interested in this feature, please submit a pull request!'); | ||
} | ||
|
||
/** | ||
* @deprecated | ||
* @return {void} | ||
*/ | ||
configureUglifyJsPlugin() { | ||
throw new Error('The configureUglifyJsPlugin() method was removed from Encore due to uglify-js dropping ES6+ support in its latest version. Please use configureTerserPlugin() instead.'); | ||
} | ||
|
||
/** | ||
* @deprecated | ||
* @return {void} | ||
*/ | ||
configureLoaderOptionsPlugin() { | ||
throw new Error('The configureLoaderOptionsPlugin() method was removed from Encore. The underlying plugin should not be needed anymore unless you are using outdated loaders. If that\'s the case you can still add it using addPlugin().'); | ||
} | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to summarize these changes in the CHANGELOG. If you could bootstrap that, it would be awesome - but I can also do it later.