Skip to content
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

feat(webpack): change plugin import paths to speed up config loading #23021

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Apr 26, 2024

This PR updates the import for NxWebpackPlugin and NxReactWebpackPlugin to avoid importing too many things. This change reduces config loading by about 33%.

The imports are now as follows:

// Plugin to build Nx-style web/node apps
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');

// Plugin to bring in React HMR, SVGR, etc.
const { NxReactWebpackPlugin } = require('@nx/react/webpack-plugin');

The old paths from @nx/webpack and @nx/react continues to work, but are deprecated. Will do a follow-up before Nx 20 to update existing configs.

Expected Behavior

Related Issue(s)

Fixes #

Copy link

vercel bot commented Apr 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Apr 26, 2024 1:59pm

packages/webpack/nx-webpack-plugin.ts Outdated Show resolved Hide resolved
packages/webpack/nx-typescript-webpack-plugin.ts Outdated Show resolved Hide resolved
Comment on lines +11 to +15
// TODO(v20): Remove this in favor of deep imports in order to load configs faster (150-200ms faster).
/** @deprecated Use NxAppWebpackPlugin from `@nx/webpack/app-plugin` instead. */
export const NxWebpackPlugin = NxAppWebpackPlugin;
/** @deprecated Use NxTsconfigPathsWebpackPlugin from `@nx/webpack/tsconfig-paths-plugin` instead. */
export const NxTsconfigPathsWebpackPlugin = _NxTsconfigPathsWebpackPlugin;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a migration in a followup?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, planning to next week.

@FrozenPandaz FrozenPandaz merged commit b8e6ebb into master Apr 26, 2024
6 checks passed
@FrozenPandaz FrozenPandaz deleted the webpack_imports branch April 26, 2024 14:42
Copy link

github-actions bot commented May 2, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants