Closed fabifink closed 2 years ago
fyi: Error happens with vite, as well as wepback4 as a bundler.
Would you provide a minimal reproduction please? π
@danielroe here is the minimal example.
It happens if I use export default defineNuxtConfig(
in nuxt.config.js
But if I continue, I get this error:
ERROR in ./components/layouts/default/CSlideshow.vue?vue&type=script&lang=ts& (./node_modules/vuetify-loader/lib/loader.js??ref--4!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/@nuxt/webpack-edge/node_modules/vue-loader/lib??vue-loader-options!./components/layouts/default/CSlideshow.vue?vue&type=script&lang=ts&) 6:47
Module parse failed: Unexpected token (6:47)
File was processed with these loaders:
* ./node_modules/vuetify-loader/lib/loader.js
* ./node_modules/@nuxt/components/dist/loader.js
* ./node_modules/@nuxt/webpack-edge/node_modules/vue-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| export default defineComponent({
| name: 'CSlideshow',
> props: { items: { required: true, type: [] as PropType<string[]> } },
| setup() {
| return {}
@ ./components/layouts/default/CSlideshow.vue?vue&type=script&lang=ts& 1:0-283 1:299-302 1:304-584 1:304-584
@ ./components/layouts/default/CSlideshow.vue
@ ./.nuxt/components/index.js
@ ./.nuxt/components/plugin.js
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/client.js
nuxt generate
instead of nuxi generate
seems to work and will result into issue https://github.com/nuxt/bridge/issues/27 which I can workaround with the shared hook code.
But the docs are telling us to use nuxi generate
.
For me the workaround to add @nuxt/bridge
to the transpile
array works, but I'm not sure if this is the way to go.
Yes, @nuxt/bridge
should be transpiled. (In fact, it should add itself to that array, so let's see what's going wrong there.)
You mean
build: {
transpile: ['@nuxt/bridge'],
},
?
That still results in
FATAL [nitro] Please use nuxt generate for static target 11:19:16
at setupNitroBridge (node_modules/@nuxt/bridge/dist/chunks/module.mjs:149:11)
at node_modules/@nuxt/bridge/dist/chunks/module.mjs:1237:15
at node_modules/hable/dist/hable.js:1:990
at node_modules/hable/dist/hable.js:1:208
at async Nuxt.callHook (node_modules/hable/dist/hable.js:1:959)
at async ModuleContainer.ready (node_modules/@nuxt/core-edge/dist/core.js:49:5)
at async Nuxt._init (node_modules/@nuxt/core-edge/dist/core.js:346:5)
After https://github.com/nuxt/bridge/pull/324 it should not show "FATAL [nitro] Please use nuxt generate for static target" anymore.
At the end it also tells me β You can now deploy .output/public to any static hosting!
But there is no .output/public
Even no .output
.
But there is no
.output
This will be fixed by https://github.com/nuxt/bridge/pull/324 too.
That's great! Maybe #365 and #27 should get added to the linked issues in this PR if they get fixed by it.
Tested nuxt generate
since it can't find the nuxi
command anymore.
The static output without ssr is unusable garbage. It seems that it still tries to build SSR stuff.
I cannot reproduce on the latest version of Nuxt Bridge with the zipfile linked by @MartinX3 above.
If you are still experiencing this, would you let me know and provide a minimal reproduction? π
Environment
Nuxt project info: 21:27:04
Darwin
v16.13.0
2.16.0-27358576.777a4b7f
yarn@1.22.17
vite
bridge
,ssr
,target
,head
,css
,plugins
,components
,buildModules
,modules
,io
,axios
,auth
,build
,router
,elementUI
,purgeCSS
,typescript
,i18n
@nuxtjs/axios@5.13.6
,@nuxtjs/auth-next@5.0.0-1617968180.f699074
,nuxt-socket-io@1.1.24
,nuxt-element-ui@1.0.10
,nuxt-i18n@6.28.1
Build Modules:
@nuxtjs/stylelint-module@4.1.0
,@nuxtjs/tailwindcss@4.2.1
,@nuxt/postcss8@1.1.3
,@nuxt/bridge@3.0.0-27566698.2b0045e
Reproduction
-
Describe the bug
I have migrated my Nuxt2 application to Nuxt-Bridge and if I run
nuxi dev
everything is working fine. But once I try to build the applications (static target) withnuxi generate
, I get the following error:If I deactivate composition API support in the nuxt.config.js, the error disappears, but I am then unable to use the composition API (Which is one of the main reasons for me to migrate).
Can you give me any hint on what I might be doing wrong here?
Additional context
No response
Logs
No response