feat(webpack): remove support for legacy browsers (#14190) #14257
+1,065
−1,565
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a preparatory refactoring / cleanup of the webpack setup.
Previously, the config is overly convoluted, where common vs web vs node concerns were mixed, and multiple options were configured then reconfigured or deleted later on.
The main change is to provide two new Nx plugins for webpack:
withNx
- Adds base webpack configuration for things like tsconfig paths, tsc/babel/swc, and type checking.withWeb
- Adds web-only concerns, such as stylesheets, images, etc.There is also a
composePlugins
function from@nrwl/webpack
that helps combine more than one configuration together. All three functions need to be documented later.Note: Behaviorally there is no change from current stable release. Both build, serve, storybook, componen-test targets should work exactly as they do currently.
What's Next
In a follow-up PR, the plugins will be manually be configured for Node, Web, and React plugins inside
webpack.config.ts
.React-only and Web-only options can be deprecated from the
@nrwl/webpack:webpack
executor and be options on eitherwithWeb
orwithReact
plugins. We may also want to update Module Federation support to compose MF with React as follows:We can also cleanup Cypress and Storybook integration by invoking the correct plugin (through
webpack.config.ts
), and not have to rely on the current workarounds.