-
Notifications
You must be signed in to change notification settings - Fork 57
Cannot import using nx/nest.js #381
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
Comments
Hey @solshark! Could you also share your package.json for analysis? |
{
"name": "@foo/source",
"version": "0.0.0",
"license": "MIT",
"scripts": {},
"engines": {
"node": ">=22.15.0",
"pnpm": ">=10.10.0"
},
"pnpm": {
"overrides": {
"rxjs": "7.8.1"
},
"onlyBuiltDependencies": [
"@nestjs/core",
"@parcel/watcher",
"@swc/core",
"esbuild",
"lmdb",
"msgpackr-extract",
"nx"
]
},
"private": true,
"dependencies": {
"@angular/common": "~19.2.0",
"@angular/compiler": "~19.2.0",
"@angular/core": "~19.2.0",
"@angular/forms": "~19.2.0",
"@angular/platform-browser": "~19.2.0",
"@angular/platform-browser-dynamic": "~19.2.0",
"@angular/router": "~19.2.0",
"@auth0/auth0-angular": "^2.2.3",
"@nestjs/common": "^10.0.2",
"@nestjs/config": "^4.0.2",
"@nestjs/core": "^10.0.2",
"@nestjs/passport": "^11.0.5",
"@nestjs/platform-express": "^10.0.2",
"axios": "^1.6.0",
"express": "^4.21.2",
"express-oauth2-jwt-bearer": "^1.6.1",
"fp-ts": "^2.16.10",
"helmet": "^8.1.0",
"io-ts": "^2.2.22",
"jira.js": "^5.1.0",
"joi": "^17.13.3",
"jwks-rsa": "^3.2.0",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"reflect-metadata": "^0.1.13",
"rxjs": "~7.8.0",
"uuid": "^11.1.0",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~19.2.0",
"@angular-devkit/core": "~19.2.0",
"@angular-devkit/schematics": "~19.2.0",
"@angular/cli": "~19.2.0",
"@angular/compiler-cli": "~19.2.0",
"@angular/language-service": "~19.2.0",
"@eslint/js": "^9.8.0",
"@nestjs/schematics": "^10.0.1",
"@nestjs/testing": "^10.0.2",
"@nx/angular": "20.8.1",
"@nx/devkit": "20.8.1",
"@nx/eslint": "20.8.1",
"@nx/eslint-plugin": "20.8.1",
"@nx/jest": "20.8.1",
"@nx/js": "20.8.1",
"@nx/nest": "20.8.1",
"@nx/node": "20.8.1",
"@nx/playwright": "20.8.1",
"@nx/web": "20.8.1",
"@nx/webpack": "20.8.1",
"@nx/workspace": "20.8.1",
"@playwright/test": "^1.36.0",
"@schematics/angular": "~19.2.0",
"@swc-node/register": "~1.9.1",
"@swc/cli": "~0.6.0",
"@swc/core": "~1.5.7",
"@swc/helpers": "~0.5.11",
"@swc/jest": "~0.2.36",
"@tailwindcss/postcss": "^4.1.5",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/node": "18.16.9",
"@types/passport-jwt": "^4.0.1",
"@typescript-eslint/utils": "^8.19.0",
"angular-eslint": "^19.2.0",
"autoprefixer": "^10.4.0",
"daisyui": "^5.0.35",
"eslint": "^9.8.0",
"eslint-config-prettier": "^10.0.0",
"eslint-plugin-playwright": "^1.6.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-environment-node": "^29.7.0",
"jest-preset-angular": "~14.4.0",
"jsonc-eslint-parser": "^2.1.0",
"ng-packagr": "~19.2.0",
"nx": "20.8.1",
"postcss": "^8.5.3",
"postcss-url": "~10.1.3",
"prettier": "^3.5.3",
"prettier-plugin-tailwindcss": "^0.6.11",
"tailwindcss": "^4.1.5",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"tslib": "^2.3.0",
"typescript": "~5.7.2",
"typescript-eslint": "^8.19.0",
"webpack-cli": "^5.1.4"
}
} |
And one for library which consume jira.js: {
"name": "@foo/projects-api",
"version": "0.0.1",
"private": true,
"type": "commonjs",
"main": "./src/index.js",
"types": "./src/index.d.ts",
"dependencies": {
"tslib": "^2.3.0"
}
}
|
Thank you! I’ll analyze it as soon as possible. If you could also set up a playground, that would be perfect! |
I cleaned up my code to create minimal reproduce. Please see here: https://github.com/solshark/jira_nx_issue
|
Could you please test the dev tag |
I'm not sure about his case, but it solved my issue with the same error, not nest.js related though. |
@MrRefactoring solved my issue as well |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
Trying to use your library with nx/nest.js
Debugger listening on ws://localhost:9229/31995edd-7a5b-49af-ae37-a749fd75d584
Debugger listening on ws://localhost:9229/31995edd-7a5b-49af-ae37-a749fd75d584
For help, see: https://nodejs.org/en/docs/inspector
ReferenceError: require is not defined in ES module scope, you can use import instead
at file:///Users//Development///node_modules/.pnpm/[email protected]/node_modules/jira.js/dist/index.cjs.js:3:13
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:400:35)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:427:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1561:24)
at Module._compile (node:internal/modules/cjs/loader:1712:5)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.load (node:internal/modules/cjs/loader:1465:32)
at Function. (node:internal/modules/cjs/loader:1282:12)
at Function.Module._load (/Users//Development///node_modules/.pnpm/@nx+js@20.8.1_@babel+traverse@7.27.1_@swc-node+register@1.9.2_@swc+core@1.5.29_@swc+hel_54e6f89c49387c61ed78b32a2be26359/node_modules/@nx/js/src/executors/node/node-with-require-overrides.js:18:31)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
NX Process exited
Code is basic:
import { Version3Client } from 'jira.js';
Node 22.15.0
jira.js 5.1.0
Typescript 5.7.2
The text was updated successfully, but these errors were encountered: