nuxt build cant find files
See original GitHub issueEnvironment
Nuxt project info: 00:24:59
- Operating System:
Windows
- Node Version:
v14.17.0
- Nuxt Version:
3-3.0.0-27235973.ad4e2e9
- Package Manager:
npm
- Bundler:
Webpack
- User Config:
debug
,srcDir
,ssr
,head
,components
,buildModules
,router
,modules
,build
- Runtime Modules:
-
- Build Modules:
-
Describe the bug
nuxt build
[vite] Internal server error: Failed to resolve import “icons/logo.svg” from “src\client\components\main\Header.vue”. Does the file exist?
nuxt config have srcDir: ‘src/client/’,
Reproduction
in component im use img class=“h-32 w-32 mx-auto” src=“/icons/logo.svg” alt=“Workflow”
Additional context
dev mode works fine builld cant find files.
Logs
ERROR 00:20:28 [vite] Internal server error: Failed to resolve import "icons/logo.svg" from "src\client\components\main\Header.vue". Does the file exist?
Plugin: vite:import-analysis
File: C:/Users/Andy/Desktop/nuxt3/udc/src/client/components/main/Header.vue
1 | import { h } from 'vue';const _sfc_main = {}
2 | import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
3 | import _imports_0 from 'icons/logo.svg'
| ^
4 |
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Nuxt build directory
Inside the directory you can find automatically generated files when using nuxt dev or your build artifacts when using nuxt build.
Read more >Nuxt.js After npm run generate cannot find files - Stack Overflow
I try to upload dist folder to my ftp but there is too same… here is my nuxt.config file const pkg = require('./package')...
Read more >Understanding folder / file structure in Nuxt | by Liam Hall
Starting a new Nuxt project for the first time may seem daunting, understanding the basic folder structure and each folders unique function ...
Read more >Nuxt js Error Couldn't find a pages directory
I am getting Error: Couldn't find a pages directory in D:\sample. Please create one under the project root how do I access pages...
Read more >Folders & Files - Academind
In a new Nuxt.js project, you see many (empty) folders and files. Nuxt.js allows you to build Vue apps that are mainly configured...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danielroe https://codesandbox.io/s/awesome-herschel-8n7pq?file=/src/client/app.vue
Remember: It works in dev mode. Doesn’t work when building!
@HenrijsS Maybe your question is asked with the updated documentation:
https://v3.nuxtjs.org/docs/directory-structure/nuxt.config#rootdir