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(react): add Vite bundler option for buildable libraries #13382

Merged
merged 1 commit into from
Nov 25, 2022

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Nov 24, 2022

This PR adds --bundle=vite option when generating React libraries.

nx g @nrwl/react:lib my-lib --buildable --bundler=vite

If you created the workspace using --preset=react-experimental then the vite bundler is the default, so you can just run:

nx g @nrwl/react:lib my-lib --buildable

Changes

  • @nrwl/vite:build executor will also copy package.json if it exists.
  • The package.json generated by @nrwl/react:lib contains correct mapping for the default formats (ESM, CJS), but users can change it if desired.
  • Remove the need to generate root babel.config.json and .babelrc since they are not needed by Vite. The root babel.config.json will be added if subsequent generators use --compiler=babel option.
  • Add lib-specific options to the generated vite.confi.ts file.

@vercel
Copy link

vercel bot commented Nov 24, 2022

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

Name Status Preview Updated
nx-dev ✅ Ready (Inspect) Visit Preview Nov 25, 2022 at 8:07PM (UTC)

@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from f4dfff2 to 6a3ab05 Compare November 25, 2022 16:02
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from 6a3ab05 to 3817703 Compare November 25, 2022 16:45
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from 3817703 to a291da5 Compare November 25, 2022 16:49
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from a291da5 to 177c280 Compare November 25, 2022 17:01
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from 177c280 to f4ce099 Compare November 25, 2022 17:09
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from f4ce099 to 9923464 Compare November 25, 2022 17:22
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from 9923464 to 4ee4d15 Compare November 25, 2022 18:58
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch 2 times, most recently from 3898fcb to 6954f4f Compare November 25, 2022 19:09
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from 6954f4f to e9269a6 Compare November 25, 2022 19:17
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from e9269a6 to 975ef1c Compare November 25, 2022 19:22
@jaysoo jaysoo force-pushed the feat/vite-react-lib branch from 975ef1c to 44ce105 Compare November 25, 2022 20:03
@jaysoo jaysoo enabled auto-merge (squash) November 25, 2022 20:03
@jaysoo jaysoo merged commit a63a25d into nrwl:master Nov 25, 2022
@jaysoo jaysoo deleted the feat/vite-react-lib branch November 25, 2022 20:39
@github-actions
Copy link

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 16, 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.

2 participants