Open rushi3691 opened 5 days ago
It is recommended to use aliases to load resources in public scss files
// farm.config.js
import path from 'node:path';
export default defineConfig({
compilation: {
// ..
resolve: {
'@': path.resolve(process.cwd(), './src/assets'),
}
}
})
// _authentication.module.scss
background-image: url("@/images/Truck_wallpaper.jpg");
Steps to reproduce
clone https://github.com/rushi3691/farm-sass-issue
Reproduce link
No response
What is actually happening?
the project contains some .scss files with some image imports, farm is not able to detect those imports and throwing error
[ Farm ] Error: Failed to start the server Caused by: Error: Can not resolve
../../../images/Truck_wallpaper.jpg
from src/assets/scss/theme.scss. Original error: None.Potential Causes: 1.The file that
../../../images/Truck_wallpaper.jpg
points to does not exist. 2.Install it first if../../../images/Truck_wallpaper.jpg
is an dependency from node_modules, if you are using pnpm refer to [https://pnpm.io/faq#pnpm-does-not-work-with-your-project-here] for solutions.../../../images/Truck_wallpaper.jpg
is a alias, make sure your alias config is correct.System Info