-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
The built library does not include assets correctly in nx project? #27351
Comments
hi, Is there any progress on the issue? @jaysoo |
Hi @luojinghui, the I think we can add a plugin for this and configure |
I opened a PR for this. You can configure the plugin like: // Copies all markdown files to dist
nxCopyAssetsPlugin(['*.md']) In the meantime I think |
…7593) This PR adds a `nxCopyAssetsPlugin` for Vite to brings it to parity with the other compilers/bundlers (tsc, swc, esbuild, rollup, and webpack). When generate a lib with Vite (e.g.`nx g @nx/js:lib --bundler=vite` or `nx g @nx/react:lib --bundler=vite`), we expect it to at least copy `README.md` as an asset. Note: Vite has support for copying assets from `public/` but that is less flexible and more intended for apps, not libs. <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #27351
@jaysoo So later I tried to execute a custom nodejs script after the nx build was completed to solve the problem, but it was not so elegant. Thank you for providing another idea. I tried to upgrade the @nx/vite version to: @nx/[email protected], but did not find the corresponding plugin: @nx/vite/plugins/nx-copy-assets.plugin. Which version do I need to install? |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
I used
nx
+nx/js
+vite
to build a js library and configured the assets resources, but the build package did not include the resources in the assets, such as theREADME.md
file.Expected Behavior
When using
nx build
ornx release
, resources with assets can be correctly output, such asREADME.md
files, which is very important for npm packagesGitHub Repo
https://github.com/luojinghui/nx-project
Steps to Reproduce
pnpm install
nx run rtc-sdk:build
dist
directory to see if theREADME.md
file exists?Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
if use
@nx/js:tsc
executor to build, it's no problem!No response
The text was updated successfully, but these errors were encountered: