Comments (4)
Hi, the problem doesn't seem to come entirely from rollup, in fact rollup returns an object {__proto__: null, default: _sfc_main}
instead of a module, so the defineAsyncComponent code doesn't work and doesn't call the .default
if (comp && (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
comp = comp.default
}
Workaround that I've found for the moment is to ask rollup to put the code in es2015.
defineNuxtConfig({
vite: {
$server: {
build: {
rollupOptions: {
output: {
generatedCode: {
preset: 'es2015' // temporary fix for https://github.com/nuxt/nuxt/issues/27836
}
}
}
}
}
}
}
Generate
const BaseTestChild2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
__proto__: null,
default: _sfc_main
}, Symbol.toStringTag, { value: 'Module' }));
instead of
const BaseTestChild2 = /* @__PURE__ */ Object.freeze({
__proto__: null,
default: _sfc_main
});
and match defineAsyncComponent condition.
from nuxt.js.
For a workaround, you can add an interop default line:
const BaseTestChild2 = defineAsyncComponent(
() => import("@/components/BaseTestChild2.vue").then(r => r.default || r)
);
I don't think this is a Nuxt issue but rather a Vue one - defineAsyncComponent
probably needs to update its condition. Would you raise an issue on vuejs/core#6638 ? 🙏
from nuxt.js.
There already seems to be a way out on view concerning the behaviour of "defineAsyncComponent".
vuejs/core#8351
It says that there is also another, cleaner alternative to converting everything to es2015 in rollup to fix the problem temporarily.
defineNuxtConfig({
vite: {
$server: {
build: {
rollupOptions: {
output: {
generatedCode: {
symbols: true // temporary fix for https://github.com/nuxt/nuxt/issues/27836
}
}
}
}
}
}
}
from nuxt.js.
I would be willing to investigate adding that configuration in Nuxt by default.
from nuxt.js.
Related Issues (20)
- Hydration mismatch when using `Teleport` in combination with `useHead` scripts at `'bodyOpen'` position HOT 3
- useFetch returns null used in component when on parent data is loaded via composable useFetch on route watch HOT 5
- Unusaual page reload after creating file in server event handler HOT 1
- Package manager order in docs/getting-started/installation HOT 2
- Useless sourcemaps generated during production build
- useSEOMeta or useHead, og tag dynamic assigned by requests can't not be fetch by FB or LINE sharing HOT 6
- After importing the @ nuxtjs/i18n module, the automatically imported function cannot find the type declaration in the template HOT 1
- Nuxt3.12.0 cant use nuxt-socket-io HOT 2
- hooks not called HOT 2
- Cannot read properties of undefined (reading 'replace') HOT 4
- protocol relative `cdnUrl` creates prerendering errors HOT 2
- cloudflare-pages does not generate static pages HOT 3
- SWR Cache saving headers HOT 3
- Nuxt $fetch throws exception when accessing API with subdomain HOT 4
- [SSG] Implement Route-Based Dynamic SEO Meta Tags in SSG HOT 5
- [Docs]: vue-tsc version are different in actual .md file and docs site HOT 1
- Creating new Nuxt 3 project results in multiple issues on Windows 10 HOT 2
- Change .env file does not update runtimeConfig HOT 1
- Route Groups not working HOT 2
- the unscoped css in a layout remains even after changing the layout in dev `nuxt dev` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.js.