question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error with Nuxt v3.0.0-rc.9: Package import specifier "#build/app.config.mjs" is not defined in package

See original GitHub issue

Describe the bug

When using Histoire with Nuxt v3.0.0-rc.9 there seems to be an issue with the built-in components like <NuxtLink>. (Nuxt v3.0.0-rc.8 works fine)

  1. Visit reproduction link
  2. run npm run dev - everything should work fine.
  3. Uncomment the <NuxtLink> in the BaseButton.vue component and reload webcontainer.

Error occurs: Error while collecting story /home/projects/nuxt-starter-sf9sq6/stories/BaseButton.story.vue: TypeError [ERR_PACKAGE_IMPORT_NOT_DEFINED]: Package import specifier “#build/app.config.mjs” is not defined in package /home/projects/nuxt-starter-sf9sq6/node_modules/nuxt/package.json imported from /home/projects/nuxt-starter-sf9sq6/node_modules/nuxt/dist/app/config.mjs

There is also an issue in the Nuxt repo regarding this issue: https://github.com/nuxt/framework/issues/7244

Reproduction

https://stackblitz.com/edit/nuxt-starter-sf9sq6?file=components/BaseButton.vue

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @histoire/plugin-nuxt: ^0.10.7 => 0.10.7 
    @histoire/plugin-vue: ^0.10.7 => 0.10.7 
    histoire: ^0.10.7 => 0.10.7

Used Package Manager

npm

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
grmnncommented, Sep 20, 2022

The BaseButton.vue component has a <NuxtLink> inside which is commented out, if I uncomment the <NuxtLink>, I still get the error.

1reaction
grmnncommented, Oct 12, 2022

As stated in the initial post of this issue, something changed in Nuxt RC.9 because stories with NuxtLink in it were working in Histoire with Nuxt RC.8.

I’ve now again an issue when using the Nuxt Icon Module since it also relies on the nuxt context, it is not working with Histoire and I again get these errors “package import specifier…”. Also I am not able to go back to RC.8 because the module needs atleast RC.9.

We are exploring ideas in Nuxt to make this easier to integrate with tools like Histoire, but until then you’ll need to stub NuxtLink.

It’s not a bug with Histoire; there are quite a lot of Nuxt core composables or components that depend on a broader Nuxt context. But possibly we could provide some built-in stubs in histoire - what do you think @Akryum?

So until this is not resolved, we would need create workarounds for all components which rely directly on the nuxt context or use components which rely on it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt 3 package import specifier "#internal/nitro" is not defined
If you are using Nuxt and encounter this error, chances likely that this is not the correct solution. Please find another one).
Read more >
Package import specifier "#build/app.config.mjs" is not defined ...
I have the issue with a .story.vue file too. It happens on RC-9 and RC-10. Error while collecting story ...
Read more >
[nuxt] [request error] require is not defined in es module scope ...
How can I go about requiring or importing this CommonJS module (algosdk 1.18.1) with Nuxt3/Vite? Attempts using Require: const algosdk = require('algosdk') and ......
Read more >
Commands and Deployment - Nuxt
Using in package.json · Development Environment · List of Commands · Webpack Config Inspection · Production Deployment · What's next?
Read more >
nuxt/webpack-builder - NPM Package Overview - Socket.dev
Start using Socket to analyze @nuxt/webpack-builder and its 39 ... and defineNuxtConfig imports from nuxt (import from nuxt/config ) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found