-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
SvelteKit | SyntaxError: Named export 'IcuFormatter' not found. #3021
Comments
Hello. I am looking into it. To the questions:
|
I just tried to bootstrap new project and everything seems to be working. However, the Sveltekit we are using in the library and our test app is outdated, so I've updated both. #3022 |
Hello. Thanks, @JanCizmar for looking into it. 1st step: I firstly clone the @tolgee/svelte-testapp repository package.json "@sveltejs/adapter-static": "1.0.0-next.23",
"@sveltejs/kit": "1.0.0-next.206",
"@tolgee/core": "^4.7.0",
"@tolgee/svelte": "^4.7.1",
"@tolgee/ui": "^4.7.0",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"eslint": "^8.16.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^3.4.1",
"prettier": "^2.6.2",
"prettier-plugin-svelte": "^2.7.0",
"serve": "^12.0.1",
"svelte": "^3.48.0",
"svelte-check": "^2.7.1",
"svelte-preprocess": "^4.10.6",
"tslib": "^2.4.0",
"typescript": "^4.7.2" 2nd step: The result is exactly the same as in the first post. I bumped all dDependencies to the latest releases "@sveltejs/adapter-static": "1.0.0-next.34",
"@sveltejs/kit": "1.0.0-next.355",
"@tolgee/core": "^4.7.0",
"@tolgee/svelte": "^4.7.1",
"@tolgee/ui": "^4.7.0",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^4.0.0",
"prettier": "^2.7.1",
"prettier-plugin-svelte": "^2.7.0",
"serve": "^13.0.2",
"svelte": "^3.48.0",
"svelte-check": "^2.8.0",
"svelte-preprocess": "^4.10.7",
"tslib": "^2.4.0",
"typescript": "^4.7.4" After a few necessary changes to correct code for breaking changes between versions of SvelteKit.
Unfortunately, result is the same: Prerendering
file:///Users/oskar/Desktop/projects/svelte/demo/svelte-example/.svelte-kit/output/server/entries/pages/__layout.svelte.js:2
import { Tolgee, IcuFormatter, TolgeeConfig } from "@tolgee/core";
^^^^^^^^^^^^
SyntaxError: Named export 'IcuFormatter' not found. The requested module '@tolgee/core' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@tolgee/core';
const { Tolgee, IcuFormatter, TolgeeConfig } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
at async Promise.all (index 0)
at async respond$1 (file:///Users/oskar/Desktop/projects/svelte/demo/svelte-example/.svelte-kit/output/server/index.js:1751:13)
at async resolve (file:///Users/oskar/Desktop/projects/svelte/demo/svelte-example/.svelte-kit/output/server/index.js:2140:105)
at async respond (file:///Users/oskar/Desktop/projects/svelte/demo/svelte-example/.svelte-kit/output/server/index.js:2095:22)
at async visit (file:///Users/oskar/Desktop/projects/svelte/demo/svelte-example/node_modules/@sveltejs/kit/dist/vite.js:1121:20)
SyntaxError: Named export 'IcuFormatter' not found. The requested module '@tolgee/core' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@tolgee/core';
const { Tolgee, IcuFormatter, TolgeeConfig } = pkg;
[vite-plugin-svelte-kit] 500 /
SyntaxError: Named export 'IcuFormatter' not found. The requested module '@tolgee/core' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@tolgee/core';
const { Tolgee, IcuFormatter, TolgeeConfig } = pkg;
> 500 /
at file:///Users/oskar/Desktop/projects/svelte/demo/svelte-example/node_modules/@sveltejs/kit/dist/vite.js:1020:11
at save (file:///Users/oskar/Desktop/projects/svelte/demo/svelte-example/node_modules/@sveltejs/kit/dist/vite.js:1239:4)
at visit (file:///Users/oskar/Desktop/projects/svelte/demo/svelte-example/node_modules/@sveltejs/kit/dist/vite.js:1130:3)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
oskar@imac27 svelte-example % So It's failing for me in both, locked to old versions, and after updating to new versions of all dependencies. |
That's odd. What version of Node.js are you using? |
v18.3.0 |
OK, now I am getting the same error. I'll look into that tomorrow. Weird that our e2e tests on production build were passing. Maybe node v16 makes the difference. (We were using v14). |
Cool. Thank you @JanCizmar |
OK, so I found the root cause of this whole issue. There was an issue in TypeScript. microsoft/TypeScript#45813 After updating typescript version in @tolgee/core everything seems to be working. So let me release new version :) |
I also created an example with the locale routing (the 2nd question): https://github.com/JanCizmar/tolgee-svelte-locale-routing |
Hi there,
Fresh install, followed by guide
During the build I get an error:
And I have two extra questions not sure if are more related to Tolgee or SvelteKit:
The text was updated successfully, but these errors were encountered: