Skip to content

fix(js): integrate buildable bundler and compiler options #15376

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

Merged
merged 1 commit into from
Mar 3, 2023

Conversation

mandarini
Copy link
Member

@mandarini mandarini commented Mar 2, 2023

Moved from here: #15090

After discussions, we decided to integrate the buildbale, bundler and compiler options of the js:lib generator, to make it more transparent.

So, the changes are on the @nrwl/js:lib generator. See the NEW documentation here.

Current behaviour

  • If we don't pass the buildable flag, and we don't pass a bundler either, then library will be buildable with @nrwl/js:tsc as the build executor since it defaults to "@nrwl/js:tsc" executor.

  • If you do pass the buildable flag and miss to pass the bundler, it will default to @nrwl/js: + options.compiler for the executor.

  • The only way to get the @nrwl/js:tsc or @nrwl/js:swc executors is to leave bundler undefined

  • The only way to get a non-buildable lib is to specifically pass --bundler=none

So we need to find a way to deprecate the buildable flag, but still be able to get the js:tsc or js:swc executors from the bundler. And make the behaviour more transparent.

Expected behaviour

--bundler=swc|tsc|rollup|vite|esbuild|none

Use Case 1: Don't want to bundle but want to build

--bundler=esbuild (esbuildOptions.bundle = false)
--bundler=tsc
--bundler=swc

Use Case 2: Want to bundle

--bundler=esbuild (esbuildOptions.bundle = true)
--bundler=vite
--bundler=rollup

Use Case 3: Not buildable/bundled

--bundler=none

Cases we want to deprecate:

tsc           | rollup       | rollup + tsc plugin
tsc           | webpack      | webpack + tsc plugin
swc           | webpack      | webpack + swc plugin

@vercel
Copy link

vercel bot commented Mar 2, 2023

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

Name Status Preview Comments Updated
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 3, 2023 at 2:26PM (UTC)

@mandarini mandarini force-pushed the fix/jslib-bundler-update branch from be7e565 to b3f9fa7 Compare March 2, 2023 15:56

Verified

This commit was signed with the committer’s verified signature.
jonatan-ivanov Jonatan Ivanov
@mandarini mandarini merged commit b84125f into nrwl:master Mar 3, 2023
FrozenPandaz pushed a commit that referenced this pull request Mar 3, 2023

Verified

This commit was signed with the committer’s verified signature.
jonatan-ivanov Jonatan Ivanov
(cherry picked from commit b84125f)
@github-actions
Copy link

github-actions bot commented Mar 9, 2023

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 Mar 9, 2023
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

5 participants