Skip to content
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

After adding "@intlify/nuxt3" to buildModules in nuxt.config.ts there's a Nuxt error #63

Open
PiotrekPKP opened this issue May 3, 2022 · 25 comments

Comments

@PiotrekPKP
Copy link

I installed "@intlify/nuxt3" and added it to my buildModules.

After adding "@intlify/nuxt3" to buildModules in nuxt.config.ts there's a Nuxt error:

__vite_ssr_import_2__.default is not a function

The error occurs even after reinstallation of package and after removing .nuxt directory.

Stacktrace:

at ./.nuxt/dist/server/server.mjs:3590:60
at fn (./.nuxt/dist/server/server.mjs:396:27)
at Object.callAsync (./node_modules/unctx/dist/index.mjs:41:19)
at callWithNuxt (./.nuxt/dist/server/server.mjs:398:23)
at applyPlugin (./.nuxt/dist/server/server.mjs:353:29)
at Module.applyPlugins (./.nuxt/dist/server/server.mjs:363:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async createNuxtAppServer (./.nuxt/dist/server/server.mjs:46:7)
at async renderToString (./node_modules/vue-bundle-renderer/dist/index.mjs:252:19)
at async ./.nuxt/dev/index.mjs:486:20

The line that shows an error is this one:

const loadedOptions = await __vite_ssr_import_2__.default();

This line is in a code block:

const { vueApp: app } = nuxt;
  const loadedOptions = await __vite_ssr_import_2__.default();
  if (!isEmpty(__vite_ssr_import_3__.default)) {
    loadedOptions.messages = __vite_ssr_import_3__.default;
  }
  const i18n = __vite_ssr_import_0__.createI18n({
    legacy: false,
    globalInjection: true,
    locale: "en",
    ...loadedOptions
  });
  app.use(i18n);
@fatrex
Copy link

fatrex commented May 10, 2022

Hey @PiotrekPKP! Are you using Nuxt3 rc2?
I'm having the same issue and I'm trying to understand how to solve this

Thanks!

@adriaandotcom
Copy link

Seems like it's related to #64

@PiotrekPKP
Copy link
Author

PiotrekPKP commented May 10, 2022

Hey @PiotrekPKP! Are you using Nuxt3 rc2? I'm having the same issue and I'm trying to understand how to solve this

Thanks!

Yes, I'm using Nuxt 3 RC 2

EDIT: It's also broken on RC 3 which came out today

@PiotrekPKP
Copy link
Author

Seems like it's related to #64

More like #64 is related to this issue ;)

@OhSoooLucky
Copy link
Contributor

OhSoooLucky commented May 13, 2022

As this issue is the last one that's open.

Overriding the following packages in package.json will temporarily fix it by forcing rc-1 to be used

  "overrides": {
    "nuxi": "3.0.0-rc.1",
    "nuxt": "3.0.0-rc.1",
    "@nuxt/kit": "3.0.0-rc.1",
    "@nuxt/schema": "3.0.0-rc.1",
    "@nuxt/vite-builder": "3.0.0-rc.1"
  }

@OhSoooLucky
Copy link
Contributor

I've created a PR #65 as per @exreplay's findings: #64 (comment)

The patch has been found to work with RC.3

@OhSoooLucky
Copy link
Contributor

Merged for v0.2.2

@phcent
Copy link

phcent commented May 19, 2022

Merged for v0.2.2

invalid

@Rasul1996
Copy link

@kazupon

@androcado
Copy link

Same issue. Do you have an idea? THX

npm install --save-dev @intlify/nuxt3

nuxt.config.ts
export default defineNuxtConfig({
ssr: false, // Client-side only rendering (false)
buildModules: ['@intlify/nuxt3']
})

error:
Uncaught SyntaxError: The requested module '/_nuxt/.nuxt/intlify.vuei18n.options.mjs' does not provide an export named 'default'


"devDependencies": {
"@intlify/nuxt3": "^0.2.2",
"bulma": "^0.9.4",
"nuxt": "3.0.0-rc.4",
"sass": "^1.51.0"
},

@OhSoooLucky
Copy link
Contributor

OhSoooLucky commented Jun 16, 2022

@androcado Try adding @intlify/nuxt3 to modules, not buildModules in the nuxt config.

@androcado
Copy link

@androcado Try adding @intlify/nuxt3 to modules, not buildModules in the nuxt config.

Thanks. But same issue:

export default defineNuxtConfig({
modules: ['@intlify/nuxt3'],
})

error:
vite_ssr_import_2.default is not a function

@OhSoooLucky
Copy link
Contributor

Odd, because I can't reproduce it

@androcado
Copy link

Odd, because I can't reproduce it

Thank you for your quick support:

npx nuxi init nuxt-app
cd nuxt-app
npm i
npm install --save-dev @intlify/nuxt3

// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@intlify/nuxt3'],
})

npm run dev // localhost: 3000 -> Uncaught SyntaxError: The requested module '/_nuxt/.nuxt/intlify.vuei18n.options.mjs' does not provide an export named 'default' (at plugin.mjs:3:8)

package.json
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
"devDependencies": {
"@intlify/nuxt3": "^0.2.2",
"nuxt": "3.0.0-rc.4"
}
}

npm -v // 6.14.11
node -v // v14.16.0
System: Windows 10

@OhSoooLucky
Copy link
Contributor

OhSoooLucky commented Jun 17, 2022

@androcado What does your package-lock.json look like?

I've recreated the application using your exact specification, albeit on MacOS
image

Would you mind sharing your package-lock please?
I'll try to get a windows device to test the same config out

EDIT: Confirmed on Windows using Node v14.16.0 and NPM 6.14.11
image

@androcado
Copy link

androcado commented Jun 19, 2022

Here is the package lock file. thx for the support

test1

Unbenanq343nt-2

package-lock.zip

@kkurt
Copy link

kkurt commented Jun 27, 2022

I am getting the same error, is there any fix/solutuion ?

@exreplay
Copy link

@kkurt @androcado do you guys have the same problem with a fresh project just using the @intlify/nuxt3 package?

I'm having multiple projects running on [email protected] with @intlify/[email protected] and not having any issues.

@OhSoooLucky
Copy link
Contributor

@kkurt @androcado do you guys have the same problem with a fresh project just using the @intlify/nuxt3 package?

I'm having multiple projects running on [email protected] with @intlify/[email protected] and not having any issues.

is this on Mac or linux by chance?

@kkurt
Copy link

kkurt commented Jun 28, 2022

@kkurt @androcado do you guys have the same problem with a fresh project just using the @intlify/nuxt3 package?
I'm having multiple projects running on [email protected] with @intlify/[email protected] and not having any issues.

is this on Mac or linux by chance?

Yes i have still same issue.
I realized that this is about OS. Because I have created fresh new project on stackblitz. There is no problem.
But wehen i download same project to my local and run after "npm install", i recieved error.
My OS is Win 11.

Stackblitz link : https://stackblitz.com/edit/nuxt-starter-va5flv

@OhSoooLucky
Copy link
Contributor

OhSoooLucky commented Jun 28, 2022

@kkurt What version of node and NPM are you running? My tests also failed when running on Windows.

MacOS and Linux work fine (for me)

@kkurt
Copy link

kkurt commented Jun 28, 2022

@kkurt What version of node and NPM are you running? My tests also failed when running on Windows.

MacOS and Linux work fine (for me)

I also tried with yarn.

NodeJS : 16.15.1
Npm: 8.13.1
Yarn: 1.22.19

@androcado
Copy link

Thanks, with the last update it works for me.

@productdevbook
Copy link

productdevbook commented Jul 10, 2022

image

pnpm run dev and see problem

@SVV-team
Copy link

#72 (comment)

For nuxt3 i18 from community

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests