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. #3244

Closed
goulashify opened this issue Sep 10, 2023 · 3 comments · Fixed by #3245
Closed

Broken imports with Vue 3 and Histoire. #3244

goulashify opened this issue Sep 10, 2023 · 3 comments · Fixed by #3245
Assignees

Comments

@goulashify
Copy link

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.

@stepan662
Copy link
Collaborator

Thanks for reporting. I'll try to fix that.

@stepan662 stepan662 self-assigned this Sep 11, 2023
@stepan662 stepan662 linked a pull request Sep 11, 2023 that will close this issue
@goulashify
Copy link
Author

goulashify commented Sep 11, 2023

Super duper, thanks Štěpán!

@goulashify
Copy link
Author

goulashify commented Sep 12, 2023

Just tested, works great, thanks again!

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

Successfully merging a pull request may close this issue.

2 participants