Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

May need resolveVuex and resolveVueRouter #23

Closed
ais-one opened this issue Apr 30, 2020 · 6 comments
Closed

May need resolveVuex and resolveVueRouter #23

ais-one opened this issue Apr 30, 2020 · 6 comments

Comments

@ais-one
Copy link
Contributor

ais-one commented Apr 30, 2020

Refer to #22

Also refer to the file https://github.com/vuejs/vite/blob/master/src/node/serverPluginModules.ts

There is a resolveVue to resolve Vue JS paths properly.

    if (id === 'vue') {
      const vuePath = resolveVue(root).vue
      debugger
      await cachedRead(ctx, vuePath)
      debugModuleResolution(`vue -> ${getDebugPath(vuePath)}`)
      return
    }

A resolve for Vuex and VueRouter (and possible other libraries) may also be needed...

@akauppi
Copy link
Contributor

akauppi commented Apr 30, 2020

@ais-one Evan is doing a pretty good job. Would you please change the "adn" typo in the title. Shows respect to provide our issues polished, clean and concise. :)

@akauppi
Copy link
Contributor

akauppi commented Apr 30, 2020

For me, this works (with vue-router 4.0.0-alpha.9; Mac):

import { createRouter, createWebHistory } from 'vue-router/dist/vue-router.esm.js';

There was earlier a mention in the README that Vite might have a path mapper, at some point in the future. It also mentioned import maps as one long term solution.

Would you be fine with that approach?

@ais-one ais-one changed the title May need resolveVuex adn resolveVueRouter May need resolveVuex and resolveVueRouter Apr 30, 2020
@ais-one
Copy link
Contributor Author

ais-one commented Apr 30, 2020

typo fixed... I can try out your suggestion... I think a fix is already on the way. I am on windows...

@ais-one
Copy link
Contributor Author

ais-one commented May 1, 2020

For me, this works (with vue-router 4.0.0-alpha.9; Mac):

import { createRouter, createWebHistory } from 'vue-router/dist/vue-router.esm.js';

this works

There was earlier a mention in the README that Vite might have a path mapper, at some point in the future. It also mentioned import maps as one long term solution.

Would you be fine with that approach?

let me read up more on this

@mikekidder
Copy link

It appears the resolver is matching twice for Vuex

import { useStore } from "vuex";

The browser attempts to load bundler as:
http://10.0.75.1:3000/@modules/%5C@modules%5Cvuex%5Cdist%5Cvuex.esm-bundler.js

Where as the following import works:

import { useStore } from "vuex/dist/vuex.esm-bundler";

@yyx990803
Copy link
Member

Tested with latest vite and it's working with vuex@next and vue-router@next. Please open new issue if still having problems.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants