-
Notifications
You must be signed in to change notification settings - Fork 46
require is not defined when using nuxtjs/composition-api #134
Comments
Hey @kylemod, I've also run into this issue and I guess this is a bug on the |
* addresses issue with .mjs format (nuxt + jest) * uses `require.resolve` to locate templates * compile composables into single file * reverts 16e21eb (#470) * retains auto-registration for testing (in cjs export - if `process.env.NODE_ENV === 'test'`) closes #476, closes #479 (by implementing), closes nuxt/vite#134, closes nuxt/vite#123
* addresses issue with .mjs format (nuxt + jest) * compile composables into single file * registers composition API using webpack entrypoint (or, for vite, by overriding `./middleware.js` import) * retains auto-registration for testing (in cjs export - if `process.env.NODE_ENV === 'test'`) closes #476, closes #479 (by implementing) Also should cover nuxt/vite#134 and nuxt/vite#123.
Closing issue. See rework composition api registration |
img if using require giving same error |
Did you found a solution? |
same problem. did u find any solution? |
@cyanerd you are most likely using Vite for your packing. |
In template: In the script: |
Versions
nuxt-vite: 0.0.37
nuxt: 2.15.4
Reproduction
A fresh install of nuxt app and nuxtjs/composition-api
Description
It just says
require is not defined at http://localhost:3000/@fs/my/storage/path/nuxt-vite/node_modules/@nuxtjs/composition-api/dist/register.js?v=c9e46a53:3:13
in my consoleAnd when i use a hook like onMounted, my terminal printed
ERROR [Vue warn]: onMounted is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().
The text was updated successfully, but these errors were encountered: