npm run generate breaks when import contains re-export `export { default as xxx } from 'ooo'`
See original GitHub issue
Forwarded from downstream issue: |
Environment
Nuxt project info:
- Operating System:
Darwin
- Node Version:
v14.18.2
- Nuxt Version:
3.0.0-rc.3
- Package Manager:
npm@6.14.17
- Builder:
vite
- User Config:
typescript
,publicRuntimeConfig
,buildModules
,alias
,vite
- Runtime Modules:
-
- Build Modules:
@pinia/nuxt@0.1.9
Reproduction
https://codesandbox.io/s/angry-johnson-3h59db?file=/app.vue
Run npm run generate
from the terminal.
<template>
<div>
<NuxtWelcome />
</div>
</template>
<script>
// the swiper js package has re-export in entry point
import { Pagination } from "swiper";
console.log(Pagination);
export default {};
</script>
Describe the bug
If package you used contains re-export syntex, then npm run generate
didn’t work.
Additional context
The import was incorrectly resolved to import Pagination from './modules/pagination/pagination.js';
in the /sandbox/.nuxt/prerender/chunks/app/server.mjs
. and thus break the build
Logs
ERROR [nuxt] [request error] Cannot find module '/sandbox/.nuxt/prerender/chunks/app/modules/pagination/pagination.js' imported from /sandbox/.nuxt/prerender/chunks/app/server.mjs
at new NodeError (internal/errors.js:322:7)
at finalizeResolution (internal/modules/esm/resolve.js:308:11)
at moduleResolve (internal/modules/esm/resolve.js:731:10)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:842:11)
at Loader.resolve (internal/modules/esm/loader.js:89:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:76:40)
at link (internal/modules/esm/module_job.js:75:36)
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
npm run generate breaks when import contains re-export ` ...
npm run generate breaks when import contains re-export export { default as xxx } from 'ooo' #5348. Open. mmis1000 opened this issue on...
Read more >npm start throwing errors related to the exports for no reason
On both my PC and old laptop (with windows) it works fine, but here i'm getting errors saying that export 'default' (imported as...
Read more >Overview
Building on that work, the new Generator type is an Iterator that always has both the return and throw methods present, and is...
Read more >error [authguard] in order to use "defaultstrategy", please, ...
When I run npm test on default procject I get [ExceptionHandler] In order to use "defaultStrategy", please, ensure to import PassportModule in each...
Read more >Correctly auto-import default ES6 modules re-exported as ...
This is a problem with reactstrap components that has to be imported as import {XXX} from "reactstrap"; but are imported as import XXX...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danielroe I’m pretty sure linked PR is something worth to consider but I cannot reproduce issue anymore with nuxt edge. Can you please help to make a reproduction for nitro? (Update: Neither with rc.8 and latest deps. both prod and dev log
[Function: Pagination]
…)Good point. Will do my best to replicate in simpler form. Might be soluble in nuxt also.