-
Notifications
You must be signed in to change notification settings - Fork 8
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
Can we remove "type": "module" from package.json #51
Comments
Hi, I'll look into it next week as I can't ATM sorry |
@Rubilmax what if we use some bundlers to output both esm and cjs dist? you can try to use it on ts-node with cjs project. then you should be able to reproduce it. if you can manage to avoid the error, let me know. |
🎉 This issue has been resolved in version 4.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@Rubilmax Removing this cause problem with esm project though
|
What's the framework you use? Your setup? |
It still doesn't seem to work well with cjs projects. Here's what I get:
|
Can you provide me with more details on your setup pls? Package.json, tsconfig.json |
Of course, thanks. Here they are: package.json{
"name": "rfq-service",
"version": "1.0.0",
"description": "",
"main": "main.ts",
"directories": {
"doc": "docs"
},
"dependencies": {
"@types/express": "^4.17.13",
"@types/node": "^18.16.0",
"axios": "^1.5.1",
"dotenv": "^16.3.1",
"ethers": "^6.7.1",
"ethers-multicall-provider": "^4.2.0",
"express": "^4.18.2",
"reflect-metadata": "^0.1.13",
"typedi": "^0.10.0",
"typescript": "^5.2.2",
"winston": "^3.10.0",
"winston-loki": "6.0.5"
},
"devDependencies": {
"@types/chai": "^4.3.6",
"@types/mocha": "^9.1.1",
"chai": "^4.3.10",
"mocha": "^10.0.0",
"nock": "^13.3.3",
"patch-package": "^8.0.0",
"prettier": "^3.0.3",
"ts-node": "^10.9.1"
},
"scripts": {
"start": "ts-node src/main.ts"
}
...
} tsconfig.json{
"include": [
"**/*.ts"
],
"exclude": [],
"compilerOptions": {
"types": [
"node", "mocha"
],
"incremental": true, /* Enable incremental compilation */
"target": "ES6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"importHelpers": true, /* Import emit helpers from 'tslib'. */
"downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
"strict": true, /* Enable all strict type-checking options. */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
"emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"resolveJsonModule": true,
}
} |
Sorry for the delay, it should be good with v5. It wasn't an easy one: the fix was to use |
Amazing, thanks a lot! |
After I upgraded this package to 4.1.0 (for using ethers v6), I got ERR_REQUIRE_ESM error on ts-node:
It is caused by the "type": "module" on the package.json. My project is not an ES module project and it's hard to upgrade it to an ES module project, I got a lot of errors when I was trying to use the ES module on my project.
The current situation of the ES module on the node ecosystem is chaotic and fucked up.
So, can we remove the type: module restriction so that I can use the commonjs module resolution on typescript to import this package?
The text was updated successfully, but these errors were encountered: