GithubHelp home page GithubHelp logo

Comments (8)

stackblitz avatar stackblitz commented on August 27, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from nuxt.js.

huang-julien avatar huang-julien commented on August 27, 2024

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.

madeofsun avatar madeofsun commented on August 27, 2024

@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.

huang-julien avatar huang-julien commented on August 27, 2024

ooops I commented on the wrong issue 🤦

from nuxt.js.

huang-julien avatar huang-julien commented on August 27, 2024

I think we did something with optimizeDeps in 3.12
cc @antfu

from nuxt.js.

antfu avatar antfu commented on August 27, 2024

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.

antfu avatar antfu commented on August 27, 2024

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.

madeofsun avatar madeofsun commented on August 27, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.