You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generated file .nuxt/components/index.js should import components synchronously.
In development when we run Nuxt using yarn run dev the first line is a synchronous import which is expected as directory options explicitly set isAsync: false:
This condition is met because I'm running a production build and isAsync is now null because replaced by the above code so it use the asyncImport syntax defined.
This is still the case, after almost 2 years one of the core functionality of this plugin still doesn't work...
I spent almost 8 hours to figure out why parent components mount earlier than child components, and now I find out that I have to stop using this plugin because of this bug 😭
Describe the bug
Components imported using
nuxt/components
withisAsync
option set tofalse
are imported asynchronously when building for production usingnuxt build
.To Reproduce
Steps to reproduce the behavior:
bug/non-async-components
yarn
thenyarn run build
.nuxt/components/index.js
First line is:
Expected behavior
Generated file
.nuxt/components/index.js
should import components synchronously.In development when we run Nuxt using
yarn run dev
the first line is a synchronous import which is expected as directory options explicitly setisAsync: false
:Additional context
I'm running
nuxt
v2.15.8 which embeds@nuxt/components
v2.1.8 and above (v2.2.1 when I check installed node_modules).While trying to debug I found code which may cause the issue:
components/src/scan.ts
Line 42 in 86ab5e0
Ternary operator will always fallback to
null
when file doesn't contains .async anddirIsAsync
is nottrue
. Settingsfalse
will be replaced tonull
.components/templates/components/index.js
Line 7 in 86ab5e0
This condition is met because I'm running a production build and
isAsync
is nownull
because replaced by the above code so it use theasyncImport
syntax defined.allow setting directory isAsync = false in options #239
seems to address the issue but I don't know about changing
null
totrue
.My nuxt.config.js
Merci 😊
The text was updated successfully, but these errors were encountered: