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
The requested module '@featurevisor/sdk' does not provide an export named 'createInstance' on Node 20 #269
The requested module '@featurevisor/sdk' does not provide an export named 'createInstance' on Node 20 #269
Comments
fixed import CreateInstance from '@featurevisor/sdk';
const { createInstance } = CreateInstance; |
@anatoliidaostreet: could you please share a full reproduction of the issue somehow? I would still expect Are you using |
Hello, @fahad19
tsconfig.json {
"compilerOptions": {
"target": "es2017",
"types": ["jest", "node"],
"typeRoots": ["node_modules/@types", "typings"],
"lib": ["es2015", "es2016", "es2017", "es2018", "dom"],
"module": "ESNext",
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,
"esModuleInterop": true,
"downlevelIteration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"allowJs": false,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"importHelpers": true,
"baseUrl": "src",
"outDir": "./dist",
"paths": {
"@/*": ["*"],
"@config": ["config"],
"@controllers/*": ["controllers/*"],
"@exceptions/*": ["exceptions/*"],
"@interfaces/*": ["interfaces/*"],
"@middlewares/*": ["middlewares/*"],
"@routes/*": ["routes/*"],
"@services/*": ["services/*"],
"@utils/*": ["utils/*"]
}
},
"files": ["custom.d.ts, @featurevisor/sdk"],
"include": ["src", "src/**/*.ts", ".env", "custom.d.ts", "custom.d.ts"],
"exclude": [
"dist",
"node_modules",
"test/**/*",
"ci/**/*",
"scripts/**/*",
"__mocks__/**/*",
"**/node_modules/**/*",
"**/dts/**/*",
"**/dist/**/*",
"**/*.(spec|test).ts",
"logs"
],
"compileOnSave": true,
"typeAcquisition": {
"enable": true
}
} I hope it will help |
thanks @anatoliidaostreet! I think the issue is similar as described under "Named Import" section here: https://dev.to/lico/how-to-import-and-export-in-commonjs-and-es-modules-43m1 It has same error message like your original comment above. May be I will try it out soon to fix it properly. Reopening. |
@fahad19 I got the same error when building my nuxt project. You can reproduce the issue with the nuxt example repo, just clone and run build. |
@fahad19 The above solution didn't help, nor did adding |
@meirroth: I just cloned the repo again and it's working for me: https://github.com/featurevisor/featurevisor-example-nuxt only different was I did could you please confirm if there's any different in behaviour between |
locally I am on Node.js v18 though. may be the issue is happening from v20 onwards 🤔 |
Yes we’re on Node 20
… Message ID: ***@***.***>
|
BTW, I tried |
I tried to reproduce the problem here: https://github.com/featurevisor/featurevisor-example-nodejs It works when I use GitHub Actions output for verification: https://github.com/featurevisor/featurevisor-example-nodejs/actions/runs/8397305039/job/23000378157#step:5:5 I will look into the |
this PR is where I am collecting errors and possible solutions when using imports: featurevisor/featurevisor-example-nodejs#1 |
@meirroth: I merged the PR featurevisor/featurevisor-example-nodejs#1 please let me know if your problem is solved by this. |
Guide available here: https://featurevisor.com/docs/sdks/nodejs/#consuming-the-sdk |
Hi @fahad19, thanks for looking into this!
Try running the PR featurevisor/featurevisor-example-nuxt#1 |
@meirroth: I tried running the Nuxt example locally with Node.js v20. Could both run the dev server, and also build locally. Setup GitHub Actions as well to show it's working there: featurevisor/featurevisor-example-nuxt#2 I am not sure what could possibly be different in your setup 🤔 |
@fahad19 Interesting. The Nuxt example (main branch) builds and runs dev OK, so the GitHub action won't show you any issue. The error shows only when you run build and open localhost in the browser (running on node v20). I'm sorry I didn't make this clear earlier. The PR with your suggested fix errors on build. |
I tried the following:
cannot seem to reproduce your issue at all from my side, @meirroth :( |
@fahad19 I appreciate your patience while investigating this! Here are the steps to reproduce the error:
|
I was able to reproduce the issue and adding build: {
transpile: ["@featurevisor/sdk"],
}, to the |
Thank you @yoshrubin, that fixed it! @fahad19 I updated the PR with this fix featurevisor/featurevisor-example-nuxt#1 |
Excellent stuff! I'll be able to merge by Sunday. I believe we can also update the Nuxt integration docs page available in this repository here. Once everything is updated, we can close the issue after. Great collaboration from all parties 🙌 |
Thank you It should be noted that this is a workaround not a fix. See response from Nuxt team nuxt/nuxt#26375 (comment) |
thanks @meirroth. keeping it open until we get to the bottom of this. your PR in other repo has been merged. I cannot seem to understand yet what I need to change in the |
@fahad19 I wish I knew. I messaged Daniel on the Nuxt repo. |
@fahad19 I came across this documentation which may help https://nuxt.com/docs/guide/concepts/esm#troubleshooting-esm-issues |
On Node.js v20.10.0
How can I fix it, or do you need to up the nodejs version on this package?
The text was updated successfully, but these errors were encountered: