You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Repository
main branch -> Current Behavior
fix branch -> Expected Behavior
Steps to Reproduce
Create new empty nx-workspace with npx create-nx-workspace@latest and preset None
Create nestjs lib 1: nx g @nx/nest:lib packages/backend-nest-one --publishable --importPath=@backend/nest-one
Create nestjs lib 2: nx g @nx/nest:lib packages/backend-nest-two --publishable --importPath=@backend/nest-two
Because the libraries are created with "type": "module", (esm) in package.json the index.ts files need the .js extension for the exports: add that -> export * from './lib/backend-nest-one.module.js'; and export * from './lib/backend-nest-two.module.js';
Add in NestBackendNestTwoModuleimports: [NestBackendNestOneModule], with import import { NestBackendNestOneModule } from '@backend/nest-one';
Add "@backend/nest-one": "0.0.1" in dependencies under package.json of @backend/nest-two
nx sync
Try to build lib two with nx run backend-nest-two:build
> nx run @nest/backend-nest-two:build
Compiling TypeScript files for project "@nest/backend-nest-two"...
/Users/user/Desktop/example/nest/packages/backend-nest-two/src/lib/backend-nest-two.module.ts:1:42 - error TS2307: Cannot find module '@backend/nest-one' or its corresponding type declarations.
1 import { NestBackendNestOneModule } from '@backend/nest-one';~~~~~~~~~~~~~~~~~~~
Package type is set to "module" but "cjs" format is included. Going to use "esm" format instead. You can change the package type to "commonjs" or remove typein the package.json file.
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Ran target build for project @nest/backend-nest-two (1s)
× 1/1 failed
√ 0/1 succeeded [0 read from cache]
Package Manager Version
npm --version 11.0.0
Operating System
macOS
Linux
Windows
Other (Please specify)
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Current Behavior
outputPath
andexports
inpackage.json
for nestjs libraries are set incorrectly:outputPath
:"outputPath": "dist/packages/backend-nest-one"
and"outputPath": "dist/packages/backend-nest-two"
exports
inpackage.json
:Expected Behavior
Should be set as follows:
outputPath
:"outputPath": "packages/backend-nest-one/dist"
and"outputPath": "packages/backend-nest-two/dist"
exports
inpackage.json
:GitHub Repo
Repository
main branch -> Current Behavior
fix branch -> Expected Behavior
Steps to Reproduce
npx create-nx-workspace@latest
and presetNone
nx g @nx/nest:lib packages/backend-nest-one --publishable --importPath=@backend/nest-one
nx g @nx/nest:lib packages/backend-nest-two --publishable --importPath=@backend/nest-two
"type": "module",
(esm) inpackage.json
theindex.ts
files need the.js
extension for theexport
s: add that ->export * from './lib/backend-nest-one.module.js';
andexport * from './lib/backend-nest-two.module.js';
NestBackendNestTwoModule
imports: [NestBackendNestOneModule],
with importimport { NestBackendNestOneModule } from '@backend/nest-one';
"@backend/nest-one": "0.0.1"
independencies
underpackage.json
of@backend/nest-two
nx sync
nx run backend-nest-two:build
Nx Report
Failure Logs
Package Manager Version
npm --version 11.0.0
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: