cibernox / svelte-intl-precompile

I18n library for Svelte.js that analyzes your keys at build time for max performance and minimal footprint
https://svelte-intl-precompile.com
ISC License
274 stars 13 forks source link

Newest version causing errors #20

Closed MarcGodard closed 2 years ago

MarcGodard commented 2 years ago

"svelte-intl-precompile": "^0.3.4", Is causing a bunch of new errors. All other libs updated

MarcGodard commented 2 years ago

I mean version 0.4

MarcGodard commented 2 years ago
10:44:37 a.m. [vite] Error when evaluating SSR module /node_modules/precompile-intl-runtime/dist/modules/stores/formatters.js:
SyntaxError: Unexpected token '='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/Users/marcgodard/Documents/Github/swp-crm/node_modules/vite/dist/node/chunks/dep-36bf480c.js:75139:28)
10:44:37 a.m. [vite] Error when evaluating SSR module /node_modules/precompile-intl-runtime/dist/modules/index.js?v=c574d9d8:
SyntaxError: Unexpected token '='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/Users/marcgodard/Documents/Github/swp-crm/node_modules/vite/dist/node/chunks/dep-36bf480c.js:75139:28)
10:44:37 a.m. [vite] Error when evaluating SSR module /node_modules/svelte-intl-precompile/index.js:
SyntaxError: Unexpected token '='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/Users/marcgodard/Documents/Github/swp-crm/node_modules/vite/dist/node/chunks/dep-36bf480c.js:75139:28)
10:44:37 a.m. [vite] Error when evaluating SSR module /src/routes/admin/index.svelte:
SyntaxError: Unexpected token '='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/Users/marcgodard/Documents/Github/swp-crm/node_modules/vite/dist/node/chunks/dep-36bf480c.js:75139:28)
Unexpected token '='
SyntaxError: Unexpected token '='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/Users/marcgodard/Documents/Github/swp-crm/node_modules/vite/dist/node/chunks/dep-36bf480c.js:75139:28)
10:44:40 a.m. [vite-plugin-svelte] /Users/marcgodard/Documents/Github/swp-crm/src/lib/components/media/ViewDocInternal.svelte:20:2 A11y: <video> elements must have a <track kind="captions">
SyntaxError: Unexpected token '='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/Users/marcgodard/Documents/Github/swp-crm/node_modules/vite/dist/node/chunks/dep-36bf480c.js:75139:28)
__vite_ssr_import_11__.addMessages is not a function
TypeError: __vite_ssr_import_11__.addMessages is not a function
    at __layout.svelte:17:12
    at Object.$$render (/Users/marcgodard/Documents/Github/swp-crm/node_modules/svelte/internal/index.js:1684:22)
    at root.svelte:36:44
    at $$render (/Users/marcgodard/Documents/Github/swp-crm/node_modules/svelte/internal/index.js:1684:22)
    at Object.render (/Users/marcgodard/Documents/Github/swp-crm/node_modules/svelte/internal/index.js:1692:26)
    at render_response (file:///Users/marcgodard/Documents/Github/swp-crm/node_modules/@sveltejs/kit/dist/ssr.js:482:28)
    at async respond_with_error (file:///Users/marcgodard/Documents/Github/swp-crm/node_modules/@sveltejs/kit/dist/ssr.js:1133:10)
    at async respond$1 (file:///Users/marcgodard/Documents/Github/swp-crm/node_modules/@sveltejs/kit/dist/ssr.js:1202:10)
    at async render_page (file:///Users/marcgodard/Documents/Github/swp-crm/node_modules/@sveltejs/kit/dist/ssr.js:1440:19)
    at async resolve (file:///Users/marcgodard/Documents/Github/swp-crm/node_modules/@sveltejs/kit/dist/ssr.js:1703:10)
cibernox commented 2 years ago

What node version are you running? If you are in 14, try 16. I have no proof but it looks to me like some code being transpiled to something node 14 doesn't understand.

MarcGodard commented 2 years ago

I am still using node 12.... lol guess i should try upgrading that.

cibernox commented 2 years ago

I mean, it's just a theory after the error. I don't think anything has hanged in v0.4 to cause that except perhaps updating some dependencies, which may in turn be using ES2021 features. With svelte SSR I had problems before with untranspiled code not working except in the very latest node.

MarcGodard commented 2 years ago

Well version 0.3.4 is when the error started when I looked through the versions trying them. 0.3.3 worked well.

taffit commented 2 years ago

I had a similar error, in my case complaining about vite/svelte-intl-precompile, but also async-error

2:10:05 PM [vite] Error when evaluating SSR module /node_modules/.pnpm/precompile-intl-runtime@0.4.7_svelte@3.43.0/node_modules/precompile-intl-runtime/dist/modules/stores/formatters.js:
SyntaxError: Unexpected token '||='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/home/user/myapp/sveltekit/node_modules/.pnpm/vite@2.6.1/node_modules/vite/dist/node/chunks/dep-a8e01c9f.js:74641:28)
2:10:05 PM [vite] Error when evaluating SSR module /node_modules/.pnpm/precompile-intl-runtime@0.4.7_svelte@3.43.0/node_modules/precompile-intl-runtime/dist/modules/index.js?v=19ad9107:
SyntaxError: Unexpected token '||='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/home/user/myapp/sveltekit/node_modules/.pnpm/vite@2.6.1/node_modules/vite/dist/node/chunks/dep-a8e01c9f.js:74641:28)
2:10:05 PM [vite] Error when evaluating SSR module /node_modules/.pnpm/svelte-intl-precompile@0.3.3_svelte@3.43.0/node_modules/svelte-intl-precompile/index.js?v=19ad9107:
SyntaxError: Unexpected token '||='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/home/user/myapp/sveltekit/node_modules/.pnpm/vite@2.6.1/node_modules/vite/dist/node/chunks/dep-a8e01c9f.js:74641:28)
2:10:05 PM [vite] Error when evaluating SSR module /src/routes/login/__layout.reset.svelte:
SyntaxError: Unexpected token '||='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/home/user/myapp/sveltekit/node_modules/.pnpm/vite@2.6.1/node_modules/vite/dist/node/chunks/dep-a8e01c9f.js:74641:28)
2:10:05 PM [vite] Error when evaluating SSR module /src/routes/login/index.svelte:
SyntaxError: Unexpected token '||='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/home/user/myapp/sveltekit/node_modules/.pnpm/vite@2.6.1/node_modules/vite/dist/node/chunks/dep-a8e01c9f.js:74641:28)
Unexpected token '||='
SyntaxError: Unexpected token '||='
    at new AsyncFunction (<anonymous>)
    at instantiateModule (/home/user/myapp/sveltekit/node_modules/.pnpm/vite@2.6.1/node_modules/vite/dist/node/chunks/dep-a8e01c9f.js:74641:28)
__vite_ssr_import_4__.addMessages is not a function
TypeError: __vite_ssr_import_4__.addMessages is not a function
    at eval (/src/routes/__layout.svelte:126:25)
    at Generator.next (<anonymous>)
    at eval (/src/routes/__layout.svelte:114:66)
    at new Promise (<anonymous>)
    at __awaiter (/src/routes/__layout.svelte:91:9)
    at load (/src/routes/__layout.svelte:119:9)
    at load_node (file:///home/user/myapp/sveltekit/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.178_svelte@3.43.0/node_modules/@sveltejs/kit/dist/ssr.js:965:30)
    at respond_with_error (file:///home/user/myapp/sveltekit/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.178_svelte@3.43.0/node_modules/@sveltejs/kit/dist/ssr.js:1096:9)
    at async respond$1 (file:///home/user/myapp/sveltekit/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.178_svelte@3.43.0/node_modules/@sveltejs/kit/dist/ssr.js:1202:10)
    at async render_page (file:///home/user/myapp/sveltekit/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.178_svelte@3.43.0/node_modules/@sveltejs/kit/dist/ssr.js:1440:19)

Upgrading node-version didn't help. After a lot of tests it turned out, that the installation of pnpm was somehow corrupt. After uninstalling it and reinstalling it via curl-sh-script, then creating node_modules from scratch, the error was gone.

Your mileage may vary, of course ...

cibernox commented 2 years ago

@taffit that's interesting, because when I updated the version of node I also wiped node_modules. Perhaps I incorrectly assumed that updating node was what fixed the issue for me but in fact it was reinstalling dependencies that made it work.

taffit commented 2 years ago

@taffit that's interesting, because when I updated the version of node I also wiped node_modules. Perhaps I incorrectly assumed that updating node was what fixed the issue for me but in fact it was reinstalling dependencies that made it work.

Although just renewing node_modules in my case didn't suffice. I did it a couple of times beforehand, also playing around with downgrading certain modules, from @svelte, @svelte/kit to svelte-intl-precompile (fantastic library, btw ;-) ), vite-plugin-host etc. Just when I tried it using plain npm install and npm run dev, it worked, leading me on the right path.

MarcGodard commented 2 years ago

Node version worked for me.