-
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
Mismatch Between Type Declaration File Names and types Field in Generated package.json #29308
Comments
…le extensions for type definitions. Updated the Rollup plugin's logic for generating type definition files to ensure compatibility with additional file extensions, including .cjs.js and .mjs.js. This change improves the handling of entry points and ensures that corresponding .d.ts files are correctly named and emitted in all supported scenarios. Added a comprehensive test case to validate the new behavior. closed nrwl#29308
…le extensions for type definitions. Updated the Rollup plugin's logic for generating type definition files to ensure compatibility with additional file extensions, including .cjs.js and .mjs.js. This change improves the handling of entry points and ensures that corresponding .d.ts files are correctly named and emitted in all supported scenarios. Added a comprehensive test case to validate the new behavior. closed nrwl#29308
I have also been facing this since upgrading from v14 to v17. When building and publishing a lib:
|
Hey @ptaranto, const copy = require('rollup-plugin-copy')
const baseConfig = {
rollupConfig: {
plugins: [
copy({
targets: [{src: 'dist/index.esm.d.ts', dest: 'dist', rename: 'index.d.ts'}],
hook: 'writeBundle',
}),
],
},
} hope this helps. |
Current Behavior
When generating a publishable library using the @nx/js generator with the Rollup bundler, the nx build command produces a type declaration file (index.cjs.d.ts) that is not consistent with the types field in the generated package.json.
Specifically:
As a result, when the package is consumed outside the workspace, TypeScript fails to locate the type declarations.
Error example:
Expected Behavior
The generated file names and package.json configuration should align. The following adjustment(s) could resolve the issue:
GitHub Repo
No response
Steps to Reproduce
npx nx g @nx/js:library packages/example-types --bundler=rollup --publishable --importPath=@myorg/example
npx nx build example-types
resulting
dist
directory:generated package.json:
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: