Comments (8)
Start a new pull request in StackBlitz Codeflow.
from nuxt.js.
Hello 👋 this is probably fixed in the nightly channel. can you try adding this piece of code in a module ?
nuxt.hook('imports:sources', (sources) => {
const routerImports = sources.find(s => s.from === '#app/composables/router' && s.imports.includes('onBeforeRouteLeave'))
if (routerImports) {
routerImports.from = 'vue-router'
}
})
or try with nuxt-nightly
from nuxt.js.
@huang-julien Thanks for the quick reply!
Unfortunately, it does not work :(
Behaviour is the same as with 3.12.3 - https://stackblitz.com/edit/github-um8mfw-4wq7pl
from nuxt.js.
ooops I commented on the wrong issue 🤦
from nuxt.js.
I think we did something with optimizeDeps in 3.12
cc @antfu
from nuxt.js.
In 3.5 there was a bug with warmup that warming up every single module, we later fixed that so now entries are lazy. And causing those dependencies are not discovered eagerly.
I had the impression for a very long time that Vite will pre-optimize entries in depedencies
field of package.json
but after a confirmation with @ patak-dev, that feature has been removed a very long while ago.
I am not sure if we could fix the warmup issue (which defeat the purpose of on-demand), but maybe we could have a better convention allow users to specify the deps to optimize? /cc @danielroe should we provide the dependenecis
list from package.json
on our end?
from nuxt.js.
I made https://github.com/antfu/vite-plugin-optimize-exclude, which might or might not help. If you are interested, please give a try in your full app and see how things would improve for you.
from nuxt.js.
@antfu Sorry for the slow reply
Currently, the best way to resolve the problem for me is to manually add each package to optimizeDeps.include
I tried the plugin like that, but there were errors:
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "getCurrentInstance"
node_modules/vue-router/dist/vue-router.mjs:6:9:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "inject"
node_modules/vue-router/dist/vue-router.mjs:6:29:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "onUnmounted"
node_modules/vue-router/dist/vue-router.mjs:6:37:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "onDeactivated"
node_modules/vue-router/dist/vue-router.mjs:6:50:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "onActivated"
node_modules/vue-router/dist/vue-router.mjs:6:65:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "computed"
node_modules/vue-router/dist/vue-router.mjs:6:78:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "unref"
node_modules/vue-router/dist/vue-router.mjs:6:88:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "watchEffect"
node_modules/vue-router/dist/vue-router.mjs:6:95:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "defineComponent"
node_modules/vue-router/dist/vue-router.mjs:6:108:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "reactive"
node_modules/vue-router/dist/vue-router.mjs:6:125:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "h"
node_modules/vue-router/dist/vue-router.mjs:6:135:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ^
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "provide"
node_modules/vue-router/dist/vue-router.mjs:6:138:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "ref"
node_modules/vue-router/dist/vue-router.mjs:6:147:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "watch"
node_modules/vue-router/dist/vue-router.mjs:6:152:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "shallowRef"
node_modules/vue-router/dist/vue-router.mjs:6:159:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "shallowReactive"
node_modules/vue-router/dist/vue-router.mjs:6:171:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "nextTick"
node_modules/vue-router/dist/vue-router.mjs:6:188:
6 │ import { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';
╵ ~~~~~~~~
ERROR [unhandledRejection] Build failed with 17 errors: 4:48:17 PM
node_modules/vue-router/dist/vue-router.mjs:6:9: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "getCurrentInstance"
node_modules/vue-router/dist/vue-router.mjs:6:29: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "inject"
node_modules/vue-router/dist/vue-router.mjs:6:37: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "onUnmounted"
node_modules/vue-router/dist/vue-router.mjs:6:50: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "onDeactivated"
node_modules/vue-router/dist/vue-router.mjs:6:65: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "onActivated"
...
node_modules/vue-router/dist/vue-router.mjs:6:9: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "getCurrentInstance"
node_modules/vue-router/dist/vue-router.mjs:6:29: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "inject"
node_modules/vue-router/dist/vue-router.mjs:6:37: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "onUnmounted"
node_modules/vue-router/dist/vue-router.mjs:6:50: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "onDeactivated"
node_modules/vue-router/dist/vue-router.mjs:6:65: ERROR: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "onActivated"
...
at failureErrorWithLog (node_modules/esbuild/lib/main.js:1651:15)
at node_modules/esbuild/lib/main.js:1059:25
at node_modules/esbuild/lib/main.js:1527:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
from nuxt.js.
Related Issues (20)
- routeRules proxy omits Content-Encoding header HOT 3
- Async/Await in router.options.ts with a nuxt composables breaks the app HOT 6
- Error deploying NUXT 3 application on IIS server
- Plugin types break if I add @nuxtjs/i18n to modules HOT 10
- useFetch doesn't convert Date to string HOT 4
- Add `#shared` alias
- Deploy production without node_modules directory HOT 2
- Server side useCookie problem HOT 1
- Potential Memory Leak HOT 4
- dynamic route is not found ! HOT 2
- Nuxt Plugin "provide" is not typed automatically since v3.13.0 HOT 7
- future: { compatibilityVersion: 4 } Messes up some types HOT 2
- serverDir not being registered HOT 3
- Client chunk too large with experimental.componentIslands.selectiveClient (to true) and @nuxt/client HOT 1
- runtime config in `.env` is not loaded in production HOT 2
- Error parsing JavaScript expression: Expecting Unicode escape sequence \uXXXX HOT 4
- Make server routes aware of page routes to avoid collisions HOT 1
- Nuxt middleware performs undefined behaviour when protecting routes HOT 2
- Property X does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{}>> HOT 2
- `useRoute.matched` is always returning 1 item - in future compatibilityVersion 4 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.