@@ -15,13 +15,13 @@ This migration also unlocks the use of `async`/`await` in Encore's internals, wh
1515impossible due to compatibility issues. For example, when we migrated from ` eslint-loader ` to ` eslint-webpack-plugin ` in
1616[ #985 ] ( https://github.com/symfony/webpack-encore/pull/985 ) , the new ESLint API was async-only, but
1717` Encore.getWebpackConfig() ` was synchronous, forcing a ` sync-rpc ` workaround to bridge the gap.
18- Even though the issue had been _ resolved _ when ESLint support was removed,
18+ Even though the issue had been _ fixed _ when ESLint support was removed,
1919it reappeared with Babel when Encore checks whether a Babel configuration file already exists.
2020
2121Now that ` getWebpackConfig() ` is natively async, this entire class of problems disappears, and ** Encore
2222can adopt modern async APIs from the ecosystem without hacks** .
2323
24- ### BC Breaks
24+ ### BC Breaks and upgrade steps
2525
2626* Migrate from CommonJS to ESM — the package now requires ` "type": "module" ` in your project or
2727 the use of ` .mjs ` file extensions. Update your ` webpack.config.js ` :
@@ -68,7 +68,9 @@ can adopt modern async APIs from the ecosystem without hacks**.
6868 options .implementation = require .resolve (' sass-embedded' );
6969
7070 // After (ESM)
71- options .implementation = import .meta.resolve(' sass-embedded' );
71+ import { fileURLToPath } from ' url' ;
72+
73+ options .implementation = fileURLToPath (import .meta.resolve(' sass-embedded' ));
7274 ` ` `
7375 If you need to require a CJS-only package, use ` createRequire` :
7476 ` ` ` js
@@ -98,11 +100,11 @@ can adopt modern async APIs from the ecosystem without hacks**.
98100 [` resolve .fullySpecified ` ](https://webpack.js.org/configuration/module/#resolvefullyspecified)
99101 by default. This means **file extensions are now required** in some imports that previously
100102 worked without them:
101- - **Relative imports**: ` import (' ./shelter_join ' )` → ` import (' ./shelter_join .js' )`
103+ - **Relative imports**: ` import (' ./my-dependendy ' )` → ` import (' ./my-dependendy .js' )`
102104 - **Deep package imports** from packages that do not have an ` " exports" ` field in their
103- ` package .json ` (e.g. ` licia ` , ` jquery - ui ` , ` Hinclude ` ) :
104- ` import delegate from ' licia/delegate' ` → ` import delegate from ' licia/delegate.js' `
105- ` import ' jquery-ui/ui/widgets/progressbar' ` → ` import ' jquery-ui/ui/widgets/progressbar.js' `
105+ ` package .json ` , for example :
106+ - ` import delegate from ' licia/delegate' ` → ` import delegate from ' licia/delegate.js' `
107+ - ` import ' jquery-ui/ui/widgets/progressbar' ` → ` import ' jquery-ui/ui/widgets/progressbar.js' `
106108
107109* The package ` " exports" ` field is now restrictive: only ` " @symfony/webpack-encore" ` and
108110 ` " @symfony/webpack-encore/lib/plugins/plugin-priorities.js" ` are exposed as public entry points.
0 commit comments