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

Broken imports with Vue 3 and Histoire. #1900

Closed
goulashify opened this issue Sep 10, 2023 · 1 comment
Closed

Broken imports with Vue 3 and Histoire. #1900

goulashify opened this issue Sep 10, 2023 · 1 comment

Comments

@goulashify
Copy link

goulashify commented Sep 10, 2023

Hey there,

I ran into an issue using components w/ Tolgee inside Histoire stories:

Error while collecting story /Users/dani/dev/reacted/reacted-project/src-story/atom/form/Form.story.vue:
file:///Users/dani/dev/redacted/redacted-project/node_modules/@tolgee/vue/dist/tolgee-vue.esm.mjs:2
import { getFallback, getTranslateProps } from '@tolgee/web';
         ^^^^^^^^^^^
SyntaxError: Named export 'getFallback' not found. The requested module '@tolgee/web' 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/web';
const { getFallback, getTranslateProps } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:131:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:213:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:308:24)
    at async ViteNodeRunner.interopedImport (file:///Users/dani/dev/redacted/redacted-project/node_modules/vite-node/dist/client.mjs:324:28)
    at async ViteNodeRunner.directRequest (file:///Users/dani/dev/redacted/redacted-project/node_modules/vite-node/dist/client.mjs:224:24)
    at async ViteNodeRunner.cachedRequest (file:///Users/dani/dev/redacted/redacted-project/node_modules/vite-node/dist/client.mjs:156:14)
    at async ViteNodeRunner.dependencyRequest (file:///Users/dani/dev/redacted/redacted-project/node_modules/vite-node/dist/client.mjs:204:14)
    at async /Users/dani/dev/redacted/redacted-project/src-story/atom/form/Form.story.vue:8:31
    at async ViteNodeRunner.directRequest (file:///Users/dani/dev/redacted/redacted-project/node_modules/vite-node/dist/client.mjs:312:5)
    at async ViteNodeRunner.cachedRequest (file:///Users/dani/dev/reacted/reacted-project/node_modules/vite-node/dist/client.mjs:156:14)

To me it seems like the "scanning" process (running in Node) is failing to import Tolgee properly. Inside the browser it works great. Potentially related to some other issues @JanCizmar worked on recently (similar error).

Could someone take a look please?


I'm running latest versions from everything, see reproduced in Stackblitz:
https://stackblitz.com/edit/vite-k7xmw2?file=src%2FApp.vue.

@goulashify goulashify changed the title [tooling] Broken CommonJS import with Vue 3 and Histoire. Broken imports with Vue 3 and Histoire. Sep 10, 2023
@goulashify
Copy link
Author

Whoops. This belongs elsewhere, my bad!

See here: tolgee/tolgee-js#3244

@goulashify goulashify closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant