Skip to content

Webpack 5 #20084

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

Closed
wants to merge 9 commits into from
Closed

Webpack 5 #20084

wants to merge 9 commits into from

Conversation

clydin
Copy link
Member

@clydin clydin commented Feb 18, 2021

WIP integration test PR for default Webpack 5 support

@google-cla google-cla bot added the cla: yes label Feb 18, 2021
@clydin clydin added the target: major This PR is targeted for the next major release label Feb 18, 2021
@clydin clydin force-pushed the webpack-5 branch 13 times, most recently from cd441b6 to d41504b Compare February 25, 2021 00:16
@clydin clydin force-pushed the webpack-5 branch 14 times, most recently from 37caa34 to f811436 Compare March 3, 2021 01:33
@clydin clydin reopened this Mar 31, 2021
@clydin clydin force-pushed the webpack-5 branch 12 times, most recently from b6d144d to f64845c Compare April 7, 2021 12:45
clydin added 8 commits April 7, 2021 11:03
The `@angular-devkit/build-webpack` package now officially supports Webpack 5.
Webpack 4 support is temporarily maintained while the remainder of the tooling is transitioned.
…the build system

With this change Webpack 5 is now used by the Angular tooling to build applications. Webpack 4 usage and support has been removed.
No project level configuration changes are required to take advantage of the upgraded Webpack version when using the official Angular builders.
Custom builders based on this package that use the experimental programmatic APIs may need to be updated to become compatible with Webpack 5.

BREAKING CHANGE: Webpack 5 lazy loaded file name changes
Webpack 5 generates similar but differently named files for lazy loaded JavaScript files in development configurations (when the `namedChunks` option is enabled).
For the majority of users this change should have no effect on the application and/or build process. Production builds should also not be affected as the `namedChunks` option is disabled by default in production configurations.
However, if a project's post-build process makes assumptions as to the file names then adjustments may need to be made to account for the new naming paradigm.
Such post-build processes could include custom file transformations after the build, integration into service-side frameworks, or deployment procedures.
Example development file name change: `lazy-lazy-module.js` --> `src_app_lazy_lazy_module_ts.js`

BREAKING CHANGE: Webpack 5 web worker support
Webpack 5 now includes web worker support. However, the structure of the URL within the `Worker` constructor must be in a specific format that differs from the current requirement.
Web worker usage should be updated as shown below (where `./app.worker` should be replaced with the actual worker name):
Before: `new Worker('./app.worker', ...)`
After:  `new Worker(new URL('./app.worker', import.meta.url), ...)`
…ndle stats for Webpack 5

Newer Webpack 5 APIs allow the bundle stat generation for analytics to be optimized including less iteration of chunks and assets.
The direct Webpack test for the Webpack plugin is now updated to use Webpack 5 as Webpack 5 is now the default for the Angular tooling.
…tion

This change allows multiple instances of the `AngularWebpackPlugin` to be present in a Webpack configuration.
Each plugin instance should reference a different TypeScript configuration file (`tsconfig.json`) and the TypeScript configuration files should be setup to not include source files present in the other TypeScript configuration files. If files are included in more than one TypeScript configuration, the first plugin present in the Webpack configuration that can emit the file will be used.

Closes: angular#5072
Webpack 5 now includes web worker support. However, the structure of the URL within the `Worker` constructor must be in a specific format.
Before: `new Worker('./app.worker', ...)`
After: `new Worker(new URL('./app.worker', import.meta.url), ...)`
…rver tests

With recent improvements to the dev-server builder unit tests, additional parallel testing should now be possible.
The unused `express` dependencies are also removed.
@clydin clydin removed the target: major This PR is targeted for the next major release label Apr 8, 2021
@clydin clydin closed this Apr 8, 2021
@thw0rted
Copy link

Hi @clydin , over at #20359 they said to track this PR to see when official Webpack 5 support will land, so I can stop ignoring the mismatched peer-dep error in my npm install. Does closing this branch mean that it's no longer being worked? Is there another PR we should be tracking? (If closing the PR is a normal part of the workflow, no problem!)

@clydin
Copy link
Member Author

clydin commented Apr 13, 2021

The elements of this PR were reorganized and became part of #20466 which has been merged.
The next prerelease of v12 (due this week) will officially use Webpack 5 and no manual installation of Webpack 5 will be required.

@clydin clydin deleted the webpack-5 branch April 13, 2021 14:42
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants