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

fix: remove import attributes #705

Conversation

NRodriguezcuellar
Copy link

πŸ”— Linked issue

#704

❓ Type of change

removed the import attribute

πŸ“š Description

it seems like untyped, a package used by @nuxt/kit can't parse this syntax

Copy link

netlify bot commented Jul 12, 2024

πŸ‘· Deploy request for nuxt-storybook pending review.

Visit the deploys page to approve it

Name Link
πŸ”¨ Latest commit b0d7f8f

@tobiasdiez
Copy link
Collaborator

Thanks, but now the build fails with

Error: s/nuxt-module build: [error] Module "file:///home/runner/work/storybook/storybook/node_modules/.pnpm/@[email protected][email protected]_@[email protected]_/node_modules/@storybook/core-server/package.json" needs an import attribute of type "json"
packages/nuxt-module build:   at new NodeError (node:internal/errors:405:5)
packages/nuxt-module build:   at validateAttributes (node:internal/modules/esm/assert:89:15)
packages/nuxt-module build:   at defaultLoad (node:internal/modules/esm/load:103:3)
packages/nuxt-module build:   at ModuleLoader.load (node:internal/modules/esm/loader:417:13)
packages/nuxt-module build:   at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:288:22)
packages/nuxt-module build:   at new ModuleJob (node:internal/modules/esm/module_job:63:26)
packages/nuxt-module build:   at #createModuleJob (node:internal/modules/esm/loader:312:17)
packages/nuxt-module build:   at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:265:34)
packages/nuxt-module build:   at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:251:17)
packages/nuxt-module build:   at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:21)
Error: s/nuxt-module build: [error] Cannot load module. Please check dist: /home/runner/work/storybook/storybook/packages/nuxt-module/dist/module.mjs

Do you know what exactly is triggering the issue #704? I'm a bit confused why it refers to babel. I've found a similar error at unjs/listhen#176. But vite, rollup and esbuild all should support import assertions...

@tobiasdiez
Copy link
Collaborator

I've opened storybookjs/storybook#28594 at the storybook repo for a long-term fix (which would allow us to completely remove the package json import). But it would be good to have a temporary solution until the upstream fix is released. A bit hacky, but perhaps sufficient: just specify an object with a version field instead of actually loading the package json file. Could you please give this a try?

@NRodriguezcuellar
Copy link
Author

I see you get the error while building while I get the error when running nuxt prepare with the storybook module installed

@NRodriguezcuellar
Copy link
Author

I've opened storybookjs/storybook#28594 at the storybook repo for a long-term fix (which would allow us to completely remove the package json import). But it would be good to have a temporary solution until the upstream fix is released. A bit hacky, but perhaps sufficient: just specify an object with a version field instead of actually loading the package json file. Could you please give this a try?

Thanks for the context! I can take a look

@NRodriguezcuellar
Copy link
Author

It could be also Jiti, which may need to be updated to V2

@tobiasdiez
Copy link
Collaborator

I've now fixed the issue in #722. Many thanks for your PR! πŸ₯³

@tobiasdiez tobiasdiez closed this Jul 16, 2024
@NRodriguezcuellar
Copy link
Author

Awesome, hope i can offer some more help in the future πŸ˜„

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 this pull request may close these issues.

2 participants