bradstewart / electron-boilerplate-vue

Boilerplate application for Electron runtime
724 stars 94 forks source link

image url in less file not working for production #58

Open jsgv opened 6 years ago

jsgv commented 6 years ago

In dev mode with npm start the image is being loaded correctly. But when I build for release (npm run release), I get an error:

ERROR in ./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-15b1ee69!./~/less-loader/lib/loader.js!./~/vue-loader/lib/selector.js?type=styles&index=0!./app/Secondary.vue
Module not found: Error: Cannot resolve 'file' or 'directory' ./static/flags/4x3/un.svg in /path/to/app
 @ ./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-15b1ee69!./~/less-loader/lib/loader.js!./~/vue-loader/lib/selector.js?type=styles&index=0!./app/Secondary.vue 6:239730-239766

I am using the default webpack config as the repo.

.flag-icon-ad {
    background-image: ~"url('static/flags/4x3/ad.svg')";
}
.flag-icon-ae {
    background-image: ~"url('static/flags/4x3/ae.svg')";
}
.flag-icon-af {
    background-image: ~"url('static/flags/4x3/af.svg')";
}
// ...

I have the files in the static directory


static/
    flags/
        4x3/
            ad.svg
            ae.svg
            ...