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

__vite_ssr_import_1__.loadTranslations is not a function #33

Closed
mactanxin opened this issue Feb 9, 2022 · 6 comments
Closed

__vite_ssr_import_1__.loadTranslations is not a function #33

mactanxin opened this issue Feb 9, 2022 · 6 comments
Assignees
Labels
bug Something isn't working lib Issue related to lib wrapper
Milestone

Comments

@mactanxin
Copy link

Hi, I'm running into issues with this error every time, not sure what's wrong.
I followed the README and the Multi-Page Example.

every time with hot reload will run into

__vite_ssr_import_1__.loadTranslations is not a function
TypeError: __vite_ssr_import_1__.loadTranslations is not a function
    at load (__layout.svelte:11:26)
    at load_node (file://home/tailwind-cms/node_modules/@sveltejs/kit/dist/chunks/index.js:1610:30)
    at respond$1 (file://home/tailwind-cms/node_modules/@sveltejs/kit/dist/chunks/index.js:1812:21)
    at async render_page (file://home/tailwind-cms/node_modules/@sveltejs/kit/dist/chunks/index.js:2003:19)
    at async resolve (file://home/tailwind-cms/node_modules/@sveltejs/kit/dist/chunks/index.js:2159:10)
    at async Object.handle (//Users/xintan/Workspace/Ailink/code/ailink-tailwind-cms/src/hooks:8:19)
    at async respond (file://home/tailwind-cms/node_modules/@sveltejs/kit/dist/chunks/index.js:2123:20)
    at async file://home/tailwind-cms/node_modules/@sveltejs/kit/dist/chunks/index.js:2461:24

then

Error when evaluating SSR module /src/lib/locale/index.js:
TypeError: Class extends value #<Object> is not a constructor or null
    at Object.<anonymous> (/home/tailwind-cms/node_modules/sveltekit-i18n/dist/index.cjs:1:1446)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:201:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:175:25)
    at async Loader.import (node:internal/modules/esm/loader:178:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
    at async nodeImport (/home/tailwind-cms/node_modules/vite/dist/node/chunks/dep-f5552faa.js:60169:21)

here's my Package file:

"devDependencies": {
    "@sveltejs/adapter-auto": "next",
    "@sveltejs/adapter-static": "^1.0.0-next.26",
    "@sveltejs/kit": "next",
    "autoprefixer": "^10.4.2",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-svelte3": "^3.2.1",
    "postcss": "^8.4.5",
    "prettier": "^2.4.1",
    "prettier-plugin-svelte": "^2.4.0",
    "svelte": "^3.44.3",
    "tailwindcss": "^3.0.17"
  },
  "type": "module",
  "dependencies": {
    "@fontsource/fira-mono": "^4.5.0",
    "@lukeed/uuid": "^2.0.0",
    "cookie": "^0.4.1",
    "sveltekit-i18n": "^2.0.0-rc.0"
  }
@mactanxin
Copy link
Author

mactanxin commented Feb 9, 2022

for now, I have to stop and restart the dev server, refresh the browser then everything works fine.

Just a quick update:

after downgrade to 1.5.4, everything works fine :)

@jarda-svoboda
Copy link
Member

I think there is something wrong with the rc.0 version - could you, please try now with the latest one? Thanks!

@jarda-svoboda
Copy link
Member

jarda-svoboda commented Feb 9, 2022

Ok, i can verify that RC versions (at least of sveltekit-i18n lib) does not work as they should.. Needs to be fixed...

Getting with @2.0.0-rc.3:

500
Class extends value #<Object> is not a constructor or null
TypeError: Class extends value #<Object> is not a constructor or null

Update: This seems to be related to CJS version only – as a quick workaround you could just delete ./node_modules/sveltekit-i18n/dist/index.cjs or use a stable version 1.5.4..

@jarda-svoboda jarda-svoboda added this to the 2.0 milestone Feb 9, 2022
@jarda-svoboda jarda-svoboda added base Issue related to base functionality bug Something isn't working labels Feb 9, 2022
@jarda-svoboda jarda-svoboda self-assigned this Feb 9, 2022
@jarda-svoboda
Copy link
Member

Ok, it seems like an error in bundler. I've reported this issue here: egoist/tsup#567

@jarda-svoboda
Copy link
Member

Added temporary workaround in sveltekit-i18n@2.0.0-rc.4

@jarda-svoboda jarda-svoboda added lib Issue related to lib wrapper and removed base Issue related to base functionality labels Feb 9, 2022
@jarda-svoboda jarda-svoboda modified the milestones: 2.0, 2.x Feb 17, 2022
@jarda-svoboda
Copy link
Member

Fixed by splitting: true tsup option.

@jarda-svoboda jarda-svoboda modified the milestones: 2.x, 2.3.1 Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib Issue related to lib wrapper
Projects
None yet
Development

No branches or pull requests

2 participants