So I'm building my first vue app but I cant manage to find a way to import external CSS files under /assets/css. Is there a way to import external css files with vue? Do I need an extra package for this?
What I tried:
In main.js I tried adding import '@/assets/css/menu.css'; but it returns the following error when building the app:
error in ./src/assets/css/menu.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleNotFoundError: Module not found: Error: Can't resolve '../images/menu-back.svg' in 'C:\Users\amng8\Desktop\Ruby\app\client\src\assets\css'
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\webpack\lib\Compilation.js:925:10
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\webpack\lib\NormalModuleFactory.js:401:22
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\webpack\lib\NormalModuleFactory.js:130:21
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\webpack\lib\NormalModuleFactory.js:224:22
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\neo-async\async.js:2830:7
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\neo-async\async.js:6877:13
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\webpack\lib\NormalModuleFactory.js:214:25
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\enhanced-resolve\lib\Resolver.js:213:14
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\enhanced-resolve\lib\Resolver.js:285:5
at eval (eval at create (C:\Users\amng8\Desktop\Ruby\app\client\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:44:7
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\enhanced-resolve\lib\Resolver.js:285:5
at eval (eval at create (C:\Users\amng8\Desktop\Ruby\app\client\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\enhanced-resolve\lib\Resolver.js:285:5
at eval (eval at create (C:\Users\amng8\Desktop\Ruby\app\client\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:27:1)
at C:\Users\amng8\Desktop\Ruby\app\client\node_modules\enhanced-resolve\lib\DescriptionFilePlugin.js:67:43
@ ./src/pages/index/main.js 7:0-31
@ multi ./src/pages/index/main.js
Also tried to include
<link href="assets/css/common.css" rel="stylesheet" />
<link href="assets/css/menu.css" rel="stylesheet" />
<link href="assets/css/baseunit.css" rel="stylesheet" />
in the index.html under /public but apparently it can only get files from /public and I don't know if I should leave the files in the /public directory.
File directory print:
PS: I'm using a multi-page setup in this vue app.
I think that's all I tested. I'm new to vue.js so if you need any extra info let me know.
