Could not resolve SVG in Production Build
Closed this issue · 1 comments
bartdominiak commented
Hey,
Production build is failing after adding ?component
query to my svg source file, even if Development is working correctly.
➜ vue-carousel git:(master) yarn build
yarn run v1.22.4
warning package.json: No license field
$ vite build
vite v0.20.5
⠧ Building for production...
[vite] Build errored out.
Error: Could not resolve '../assets/icons/arrow.svg?component' from components/Carousel.vue?vue&type=script&lang.js
at error (/Users/bartek/Sites/private/vue-carousel/node_modules/rollup/dist/shared/rollup.js:217:30)
at ModuleLoader.handleResolveId (/Users/bartek/Sites/private/vue-carousel/node_modules/rollup/dist/shared/rollup.js:17617:24)
at /Users/bartek/Sites/private/vue-carousel/node_modules/rollup/dist/shared/rollup.js:17541:30
at async Promise.all (index 1)
at async ModuleLoader.fetchModule (/Users/bartek/Sites/private/vue-carousel/node_modules/rollup/dist/shared/rollup.js:17577:9)
at async /Users/bartek/Sites/private/vue-carousel/node_modules/rollup/dist/shared/rollup.js:17539:36
at async Promise.all (index 0)
at async ModuleLoader.fetchModule (/Users/bartek/Sites/private/vue-carousel/node_modules/rollup/dist/shared/rollup.js:17577:9)
at async /Users/bartek/Sites/private/vue-carousel/node_modules/rollup/dist/shared/rollup.js:17539:36
at async Promise.all (index 2) {
code: 'UNRESOLVED_IMPORT',
watchFiles: [
'/Users/bartek/Sites/private/vue-carousel/index.html',
'/Users/bartek/Sites/private/vue-carousel/main.js',
'/Users/bartek/Sites/private/vue-carousel/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js',
'/Users/bartek/Sites/private/vue-carousel/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js',
'/Users/bartek/Sites/private/vue-carousel/node_modules/@vue/shared/dist/shared.esm-bundler.js',
'/Users/bartek/Sites/private/vue-carousel/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js',
'/Users/bartek/Sites/private/vue-carousel/App.vue',
'/Users/bartek/Sites/private/vue-carousel/App.vue?vue&type=script&lang.js',
'/Users/bartek/Sites/private/vue-carousel/App.vue?vue&type=template&id=0d83b12d',
'/Users/bartek/Sites/private/vue-carousel/App.vue?vue&type=style&index=0&lang.css',
'/Users/bartek/Sites/private/vue-carousel/assets/main.scss',
'/Users/bartek/Sites/private/vue-carousel/components/Image.vue',
'/Users/bartek/Sites/private/vue-carousel/components/Container.vue',
'/Users/bartek/Sites/private/vue-carousel/components/Carousel.vue',
'/Users/bartek/Sites/private/vue-carousel/mocks/carousel.json',
'/Users/bartek/Sites/private/vue-carousel/components/CarouselSlide.vue',
'/Users/bartek/Sites/private/vue-carousel/components/Image.vue?vue&type=script&lang.js',
'/Users/bartek/Sites/private/vue-carousel/components/Image.vue?vue&type=template&id=7cbca942',
'/Users/bartek/Sites/private/vue-carousel/components/Image.vue?vue&type=style&index=0&lang.css',
'/Users/bartek/Sites/private/vue-carousel/components/Container.vue?vue&type=template&id=451e3b51',
'/Users/bartek/Sites/private/vue-carousel/components/Container.vue?vue&type=style&index=0&lang.css',
'/Users/bartek/Sites/private/vue-carousel/components/Carousel.vue?vue&type=script&lang.js',
'/Users/bartek/Sites/private/vue-carousel/components/Carousel.vue?vue&type=template&id=0631579b',
'/Users/bartek/Sites/private/vue-carousel/components/Carousel.vue?vue&type=style&index=0&lang.css',
'/Users/bartek/Sites/private/vue-carousel/components/CarouselSlide.vue?vue&type=template&id=2ad28573',
'/Users/bartek/Sites/private/vue-carousel/components/CarouselSlide.vue?vue&type=style&index=0&lang.css',
'/Users/bartek/Sites/private/vue-carousel/components/Button.vue',
'/Users/bartek/Sites/private/vue-carousel/components/Button.vue?vue&type=script&lang.js',
'/Users/bartek/Sites/private/vue-carousel/components/Button.vue?vue&type=template&id=d21fa4b6',
'/Users/bartek/Sites/private/vue-carousel/components/Button.vue?vue&type=style&index=0&lang.css'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
bartdominiak commented
Looks like its not working with relative urls. Aliases helped me.