You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
or even better use a @/ alias for the src directory.
in development mode both versions work while for production only the first variant will get transformed, while /src points to C:/src or whatever file system you`re in.
During the production build, Vite will perform necessary transforms so that the URLs still point to the correct location even after bundling and asset hashing.
Is /src.. not considered a relative path, or is this a bug?
Edit 2021.08.02: I think i narrowed the problem down while trying to create a reproduction setup. Sorry for being too lazy to do this earlier.
I think the problem has to do using the imported URLs in a computed variable. (see HelloWorld.vue: 23) and has NOTHING to do with weather the URL starts with / or ./ or whatever.
see http://localhost:3000/ and you should see 4 images. toggling the "greyscale" button changes the image sources
npm run build or npm run serve to inspect production build
open the production build in a browser. you should see, that
a. Not all assets have been exported (assetsInlineLimit is set to 0, in order to avoid inlining images.)
b. There is an error in the developer console. following it in the production js (dist/assets/index.*.js) you will see, that not all the new URL("") paths have been correctly transformed
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
Hello @Topograph. Please provide a minimal reproduction using a GitHub repository or codesandbox. Issues marked with need reproduction will be closed if they have no activity within 3 days.
hi! sorry for being lazy- it took some me some time to figure out, how i could reproduce my issue in a simple project. i created a project and linked the github repo. Following the steps in the README.md should make the error clear.
Describe the bug
instead of this:
i would like to use this
or even better use a @/ alias for the src directory.
in development mode both versions work while for production only the first variant will get transformed, while /src points to C:/src or whatever file system you`re in.
In the documentation it is stated that
Is /src.. not considered a relative path, or is this a bug?
Edit 2021.08.02: I think i narrowed the problem down while trying to create a reproduction setup. Sorry for being too lazy to do this earlier.
I think the problem has to do using the imported URLs in a computed variable. (see HelloWorld.vue: 23) and has NOTHING to do with weather the URL starts with / or ./ or whatever.
Reproduction
Link to github repo: https://github.com/Topograph/vite-issue-4416-reproduction
Reproduce issue #4416 like this
npm install
npm run dev
see http://localhost:3000/ and you should see 4 images. toggling the "greyscale" button changes the image sources
npm run build
ornpm run serve
to inspect production buildopen the production build in a browser. you should see, that
a. Not all assets have been exported (assetsInlineLimit is set to 0, in order to avoid inlining images.)
b. There is an error in the developer console. following it in the production js (dist/assets/index.*.js) you will see, that not all the
new URL("")
paths have been correctly transformedUsed Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: