-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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): add plugin to automatically configure build and serve targets #20243
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 08ddd37. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 5 targets
Sent with 💌 from NxCloud. |
c1b3180
to
d09d1a5
Compare
d09d1a5
to
7249510
Compare
7249510
to
26e204e
Compare
26e204e
to
230ebcf
Compare
1ba95e7
to
9e0f2d8
Compare
907ebd1
to
a4d1f1d
Compare
a4d1f1d
to
b3bf3b1
Compare
b3bf3b1
to
51f5a9b
Compare
51f5a9b
to
4fbd1f3
Compare
4fbd1f3
to
fd3afd6
Compare
fd3afd6
to
5c48f59
Compare
5c48f59
to
f1cc57b
Compare
1553cc6
to
8516157
Compare
8516157
to
23bc0a5
Compare
23bc0a5
to
d0174c6
Compare
d0174c6
to
51659b3
Compare
packages/webpack/src/executors/dev-server/lib/get-dev-server-config.ts
Outdated
Show resolved
Hide resolved
51659b3
to
b68ff02
Compare
b68ff02
to
dd7d8ee
Compare
d1967ee
to
bb9a2f2
Compare
bb9a2f2
to
bb48b11
Compare
bb48b11
to
662ef3f
Compare
…targets for projects
662ef3f
to
08ddd37
Compare
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. |
This PR adds support for projects using
webpack.config.js
files to have theirbuild
,serve
, andpreview
targets automatically configured by@nx/webpack/plugin
.Just need to add to your
nx.json
file:The plugin will support both
composePlugins
andNxWebpackPlugin
usages. The former requires a newisNxWebpackComposablePlugin
function that checks if anxWebpackComposablePlugin
exists on the exported function. Otherwise, the function could be a normal webpack config function.When
NX_PCV3=true
, Wwe'll also generate projects with options set in webpack config files usingNxWebpackPlugin
, rather than inproject.json
.e.g.
If
NX_PCV3=true
is not set, then everything behaves as normal.Note: We use relative paths (e.g.
main: './src/main.tsx'
), or absolute paths (e.g.output: { path: join(__dirname, '...') }
). Previously inside targets, we used paths relative to workspace root, which doesn't make sense in the new setup. You can still use paths from the workspace root to make migration easier.Summary of changes
@nx/webpack/plugin
that usesCreateNodes
to infer build, serve, and preview targets(env, args) -> config
functionschema.json
of webpack build executor to plugins (e.g.withNx
andNxWebpackPlugin
)CreateNodes
), and during actual task run (e.g. webpack build) -- need to read out options likeconfig.output.path
to determine what's cachedwithNx
) works with normal webpack CLIwebpack-cli
as a workspace dep in@nx/webpack:init
generatorwithWeb
is merged intowithNx
, and a deprecation message is show to user when used -- this should not impact most users, sincewithWeb
is not used for Reactmain
andtsConfig
, configured inwebpack.config.js
rather thanproject.json
-- existing apps will continue to function as beforeTODO