Closed RezaZR closed 4 years ago
you should give relative paths with proper project structure so that the environment in src
can be replicated in dist
as well.
You need to make changes to your project structure.
In general, assets are something that you don't want to keep inside the src
folder. it can be in the root so when deploying your site, it will be deployed as a separate folder in root as well so you can link the images without any issues.
the second thing you can do is try to replicate the src
folder in the dist
folder so you won't face these issues. copy the assets folder as well to dist
use copy-plugin for these things.
I would prefer the second option of moving the assets folder to dist
as well for your case as you are processing files in there as well.
@anikethsaha hello, thank you for your answer but can you give me example how to replicate src to dist using webpack?
use https://github.com/webpack-contrib/file-loader#publicpath and https://github.com/webpack-contrib/file-loader#outputpath and for files which are not processed through any loader rules, use copy plugin for that
Answer above, feel free to leave feedback
Hi, please help me anyone.
I add font-face on my _main.scss and then i build and send it to dist folder. Here is my project's structure:
Expected Behavior
I want the url inside main.[hash].css under dist folder targeting to dist, not targeting to src.
Actual Behavior
The url inside main.[hash].css target src. Here is the piece of code inside main.[hash].css:
Code
Please help me