Closed Elsoberanold closed 7 months ago
Hi! That's odd- I can make a new project and run your code just fine on 18.12.1. Is your package.json a type: "module"
?
Hi! That's odd- I can make a new project and run your code just fine on 18.12.1. Is your package.json a
type: "module"
?
Thanks for replying 🙌🙌 Not at all... here is my tsconfig:
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"exclude": [
"node_modules"
],
"include": [
"./src/**/*.tsx",
"./src/**/*.ts"
]
}
and my package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "test2.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "NODE_ENV=development nodemon --exec ts-node src/test-paseto.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^20.9.0",
"nodemon": "^3.0.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"dependencies": {
"paseto-ts": "^1.5.1"
}
}
Try putting "type": "module"
in your package.json. This is an ES module (not commonjs).
Try putting
"type": "module"
in your package.json. This is an ES module (not commonjs).
It works now! Thank you by the help!! I just had to change a few things: Tsconfig:
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"exclude": [
"node_modules"
],
"include": [
"./src/**/*.tsx",
"./src/**/*.ts"
]
}
and package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "test2.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "NODE_ENV=development nodemon --exec ts-node --esm src/test-paseto.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^20.9.0",
"nodemon": "^3.0.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"dependencies": {
"paseto-ts": "^1.5.1"
}
}
First of all, I want congratulate you for the work that you have done! In my current project, I have tried implement this library but unfortunately I have ran into this issue:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports"
Here is a minimal example to reproduce this error:
This example was tested with Node.JS version v18.12.1
I am not sure but perhaps it might be a problem related to exports in package.json... What do you think?