__vite_ssr_import_2__.default is not a function

See original GitHub issue

I created an empty Nuxt project npx nuxi init nuxt-app

then I added a intlify/nuxt3 yarn add -D @intlify/nuxt3

// nuxt.config.ts

import { defineNuxtConfig } from 'nuxt'

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
    buildModules: ['@intlify/nuxt3'],
    // config for `@intlify/nuxt3`
    intlify: {
        vueI18n: {
            // You can setting same `createI18n` options here !
            locale: 'en',
            messages: {
                en: {
                    hello: 'Hello'
                },
                ja: {
                    hello: 'こんにちは'
                }
            }
        }
    }
})

and i get an error __vite_ssr_import_2__.default is not a function

at /D:/work/nuxt-app/.nuxt/dist/server/server.mjs:10636:60
at fn (/D:/work/nuxt-app/.nuxt/dist/server/server.mjs:412:27)
at Object.callAsync (/D:/work/nuxt-app/node_modules/unctx/dist/index.mjs:41:19)
at callWithNuxt (/D:/work/nuxt-app/.nuxt/dist/server/server.mjs:414:23)
at applyPlugin (/D:/work/nuxt-app/.nuxt/dist/server/server.mjs:369:29)
at Module.applyPlugins (/D:/work/nuxt-app/.nuxt/dist/server/server.mjs:379:11)
at async createNuxtAppServer (/D:/work/nuxt-app/.nuxt/dist/server/server.mjs:46:7)
at async Object.renderToString (/D:/work/nuxt-app/node_modules/vue-bundle-renderer/dist/index.mjs:252:19)
at async /D:/work/nuxt-app/.nuxt/dev/index.mjs:465:20
at async /D:/work/nuxt-app/node_modules/h3/dist/index.mjs:417:19

my 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.3"
  }
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:40 (2 by maintainers)

github_iconTop GitHub Comments

15reactions
codefloristcommented, May 27, 2022

afaics the whole shebang of this package can easily be replaced by simply installing https://vue-i18n.intlify.dev/ and adding a nuxt3 plugin by placing a file (e.g. called i18n.ts) in the plugins folder with the following content:

import { createI18n } from 'vue-i18n'

import de from '../locales/de.json'
import fr from '../locales/fr.json'

const i18n = createI18n({
	legacy: false,
	globalInjection: true,
	locale: 'de',
	fallbackLocale: 'de',
	messages: {
		de,
		fr,
	},
})

export default defineNuxtPlugin((nuxtApp) => {
	nuxtApp.vueApp.use(i18n)
})
4reactions
riptincommented, May 25, 2022

Same problem with Nuxt 3 rc.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: default is not a function when using vitest
I'm using vitest to do some unit tests in my vue application. I've written some tests but they fail with the error message:...
Read more >
Importing Typescript files gives: default is not a function · Issue ...
Ava cannot handle when an imported TS file imports another module. I get the error that ~~.default is not a function .
Read more >
Calling Apex function results in a "default(...).this is not a ...
I found an answer, but wanted to leave this up in case it frustrates anyone else. I updated my VS Code LWC Extension...
Read more >
typeerror: (0 , express_1.default) is not a function - You.com
I'm getting [TypeError: (0 , express_1.default) is not a function for my code. import express from "express"; const app = express (); //...
Read more >
Ravenous Part 4 TypeError: default.search is not a function
Deploying my final ravenous project yields this issue: TypeError: util_Yelp__WEBPACK_IMPORTED_MODULE_5_.default.search is not a function.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found