Releases: symfony/webpack-encore
v5.0.1
5.0: Major dependency upgrades and deprecated features deletion, less dependencies: Encore on a diet!
Hey packagers!
Exactly one month after the last release, this new major release is now ready to be used! 🎉
This new version contains many changes, in a nutshell:
- removal of support for Node.js 19 and 21
- deletion of deprecated features, such as support for Vue 2 and ESLint.
- removal of support for
webpack-cli@4
andwebpack-dev-server@4
, - update to
sass-loader@16
,css-loader@7
andcss-minimizer-webpack-plugin@7
- makes Webpack dev-server optional
- and much more... see the full changelog below!
With all these modifications, we were able to lighten @symfony/webpack-encore
by removing ~220 dependencies comparing to the version 4.7.0, thus reducing installation times and disk writing, but also reducing the possibility of installing a dependency containing a vulnerability:
Package info for "@symfony/[email protected]": 61 MB
Released: 2024-08-29 16:26:01.762 +0000 UTC (4w3d ago)
Downloads last week: 27,421 (16.14%)
Estimated traffic last week: 1.7 TB
Subdependencies: 628
Package info for "@symfony/[email protected]": 53 MB
Released: 2024-09-29 20:08:45.238 +0000 UTC (1m20s ago)
Downloads last week: N/A (N/A%)
Estimated traffic last week: N/A
Subdependencies: 408
Estimated new statistics:
Package size: 61 MB → 53 MB (86.01%)
Subdependencies: 628 → 408 (-220)
Traffic with last week's downloads:
For current version: 1.7 TB → 1.4 TB (235 GB saved)
For all versions: 10 TB → 9.0 TB (1.5 TB saved)
Features
-
#1344 Add options configuration callback to
Encore.enableReactPreset()
(@Kocal) -
#1345 Add support for integrity hashes when asset names contain a query string (@Kocal)
BC Breaks
-
#1307 Drop
webpack-cli
4 support, onlywebpack-cli
^5.1.4 is supported (@Kocal) -
#1318 Drop webpack-dev-server 4 support, only webpack-dev-server 5 is supported (@Kocal)
The dev-server options have changed between versions 4 and 5, see the official migration guide to v5.
For example:
// With webpack-dev-server 4:
Encore.configureDevServerOptions((options) => {
options.https = {
ca: "./path/to/server.pem",
pfx: "./path/to/server.pfx",
key: "./path/to/server.key",
cert: "./path/to/server.crt",
passphrase: "webpack-dev-server",
requestCert: true,
};
});
// With webpack-dev-server 5 (now):
Encore.configureDevServerOptions((options) => {
options.server = {
type: 'https',
options: {
ca: "./path/to/server.pem",
pfx: "./path/to/server.pfx",
key: "./path/to/server.key",
cert: "./path/to/server.crt",
passphrase: "webpack-dev-server",
requestCert: true,
}
};
});
The webpack-dev-server
package is now an optional peer dependency.
It has been removed because some projects may not use it, and it was installing a bunch of unnecessary dependencies.
Removing the webpack-dev-server
dependency from Encore reduces the number of dependencies from 626 to 295 (-331!),
it helps to reduce the size of the node_modules
directory and the number of possible vulnerabilities.
To use the webpack-dev-server
again, you need to install it manually:
npm install webpack-dev-server --save-dev
# or
yarn add webpack-dev-server --dev
# or
pnpm install webpack-dev-server --save-dev
-
#1308 Drop Vue 2 support (End-Of-Life), only Vue 3 is supported (@Kocal)
-
#1313 Drop
clean-webpack-plugin
in favor of webpack'soutput.clean
configuration. The
configuration settings supported byEncore.cleanupOutputBeforeBuild
have changed (@stof) -
#1324 Drop
css-minimizer-webpack-plugin
5 support, onlycss-minimizer-webpack-plugin
7 is supported (@Kocal) -
#1342 Replace
assets-webpack-plugin
dependency by an internal plugin, to generateentrypoints.json
file (@Kocal) -
#1317 Drop support of sass-loader ^13 and ^14, add support for sass-loader ^16 (@Kocal)
The sass-loader's options have changed, the modern
options are now used by default.
Though not recommended,
you must specify the option api: 'legacy'
if you want to keep the legacy
options.
For example:
// With the legacy API:
Encore.enableSassLoader((options) => {
options.api = 'legacy';
options.includePaths = [/*...*/];
});
// With the modern API (default):
Encore.enableSassLoader((options) => {
options.loadPaths = [/*...*/];
});
Since css-loader
7.0.0,
styles imports became named by default.
It means you should update your code from:
import style from "./style.css";
console.log(style.myClass);
to:
import * as style from "./style.css";
console.log(style.myClass);
There is also a possibility to keep the previous behavior by configuring the css-loader
's modules
option:
config.configureCssLoader(options => {
if (options.modules) {
options.modules.namedExport = false;
options.modules.exportLocalsConvention = 'as-is';
}
});
Important
If you use CSS Modules inside .vue
files,
until vuejs/vue-loader#1909 is merged and released, you will need to restore the previous
behavior by configuring Encore with the code above.
Internal
-
#1327 Fix compat with configuring the devserver server as a string (@stof)
-
#1328 Remove non-existent option in our package-up utility (@stof)
-
#1329 Read the controllers.json as string rather than Buffer (@stof)
-
#1330 Add some types in the internal implementation of Encore (@stof)
-
#1343 Add tests for CSS Modules with React and Preact (@Kocal)
Upgrading
Run:
npm install "@symfony/webpack-encore@^5.0.0" --save-dev
or:
yarn upgrade "@symfony/webpack-encore@^5.0.0"
Changes: v4.7.0..v5.0.0
Happy Packing!
v4.7.0
Hey packagers, it's been a while!
After several months of inactivity, Webpack Encore is back with a few new features: many loaders upgrades, Node.js 22 support, and Vue3+JSX.
Features
-
#1284 Improve ESLint and Babel help messages, when enabling ESLint integration (@Kocal)
-
#1285 Add support for PNPM for installation commands (@Kocal)
Enabling JSX support for Vue 3 is done with the Encore.enableVueLoader()
:
Encore.enableVueLoader(() => {}, {
useJsx: true,
version: 3,
});
If you don't have a custom Babel configuration, then you're all set!
But if you do, you may need to adjust it
to add @vue/babel-plugin-jsx
plugin to your Babel configuration:
// babel.config.js
module.exports = {
plugins: [
'@vue/babel-plugin-jsx'
]
};
Deprecations
Internal
-
#1275 Update some dev-dependencies to fix vulnerability issues (@Kocal)
-
#1259 Update yarn used for test_apps to latest version (@karpilin)
-
#1304 Replace
fast-levenshtein
byfastest-levenshtein
(@Kocal)
Upgrading
Run:
npm install "@symfony/webpack-encore@^4.7.0" --save-dev
or:
yarn upgrade "@symfony/webpack-encore@^4.7.0"
Changes: v4.6.1..v4.7.0
Happy Packing!
Re-add support for Node 18
Hey packagers!
It seems I was a bit too quick to drop support for Node 18. This re-adds it.
Upgrading
Run:
npm install "@symfony/webpack-encore@^4.6.1" --save-dev
Or:
yarn upgrade "@symfony/webpack-encore@^4.6.1"
Changes: v4.6.0...v4.6.1
Happy Packing!
Node 20 bump & sass-loader 14 support
Hey packagers!
-
#1254 Increased minimum Node version to 20 (@weaverryan)
-
#1253 Allow sass-loader 14 (@cedric-anne)
Upgrading
Run:
npm install "@symfony/webpack-encore@^4.6.0" --save-dev
Or:
yarn upgrade "@symfony/webpack-encore@^4.6.0"
Changes: v4.5.0...v4.6.0
Happy Packing!
Node min version to 16 & other dependency updates
Hey packagers!
-
#1235 Dropping support for Node 14 (16 is new min) and allowing
svelte
4 (@weaverryan) -
#1185 Bump
babel-loader
from 8.2.5 to 9.1.2 (@dppanteon) - the
CHANGELOG for babel 9
does not list any breaking changes besides increasing the minimum Node version. -
#1224 Allow fork-ts-checker-webpack-plugin ^8.0 and ^9.0 (@buffcode)
Upgrading
Run:
npm install "@symfony/webpack-encore@^4.5.0" --save-dev
Or:
yarn upgrade "@symfony/webpack-encore@^4.5.0"
Changes: v4.4.0...v4.5.0
Happy Packing!
Upgrade to css-minimizer-webpack-plugin 5
Hey packagers!
This release upgrades the css-minimizer-webpack-plugin
from 4 to 5. While this dependency bump is a major bump, the underlying library had very few breaking changes and the fast majority of users should be completely unaffected by this.
Upgrading
Run:
npm install "@symfony/webpack-encore@^4.4.0" --save-dev
Or:
yarn upgrade "@symfony/webpack-encore@^4.4.0"
Changes: v4.3.0..v4.4.0
Happy Packing!
Allowing TypeScript 5 + other minor items
Hey packagers!
This release allows TypeScript 5 to be used + a few other small items:
- feature #1200 Allow TypeScript 5 (@jmsche)
- feature #1190 Allow eslint-webpack-plugin ^4.0 (@evertharmeling)
- bug #1175 Delay force sync until needed (@wesoledi, @weaverryan)
Upgrading
Run:
npm install "@symfony/webpack-encore@^4.3.0" --save-dev
Or:
yarn upgrade "@symfony/webpack-encore@^4.3.0"
Changes: v4.2.0..v4.3.0
Happy Packing!
Allowing webpack-cli v5
Hey packagers!
This release allows webpack-cli
version 5 to be used in your package.json
file.
Upgrading
Run:
npm install "@symfony/webpack-encore@^4.2.0" --save-dev
Or:
yarn upgrade "@symfony/webpack-encore@^4.2.0"
Changes: v4.1.2..v4.2.0
Happy Packing!
4.1.2 - fixes Vue 2 version problem
Hey packagers!
This release fixes an incompatibility when using @vue/compiler-sfc
with Vue 2.7. Thanks to @dmaicher in #1166 for the fix!
Upgrading
Run:
npm install "@symfony/webpack-encore@^4.1.2" --save-dev
Or:
yarn upgrade "@symfony/webpack-encore@^4.1.2"
Changes: v4.1.1..v4.1.1
Happy Packing!