intlify / nuxt3

Nuxt 3 Module for vue-i18n-next

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

PiotrekPKP opened this issue · comments

commented

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);

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

Thanks!

Seems like it's related to #64

commented

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

commented

Seems like it's related to #64

More like #64 is related to this issue ;)

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"
  }

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

The patch has been found to work with RC.3

Merged for v0.2.2

Merged for v0.2.2

invalid

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"
},

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

@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

Odd, because I can't reproduce it

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

@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

Here is the package lock file. thx for the support

test1

Unbenanq343nt-2

package-lock.zip

commented

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

@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 nuxt@3.0.0-rc.4 with @intlify/nuxt3@0.2.2 and not having any issues.

@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 nuxt@3.0.0-rc.4 with @intlify/nuxt3@0.2.2 and not having any issues.

is this on Mac or linux by chance?

commented

@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 nuxt@3.0.0-rc.4 with @intlify/nuxt3@0.2.2 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

@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)

commented

@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

Thanks, with the last update it works for me.

image

pnpm run dev and see problem

#72 (comment)

For nuxt3 i18 from community