svelte-loader-hot icon indicating copy to clipboard operation
svelte-loader-hot copied to clipboard

Any idea why emitCss doesn't work or not supported yet?

Open fsevenm opened this issue 5 years ago • 3 comments

I find this unofficial custom svelte loader with HMR support is really awesome. But with no emitCss support, the webpack cannot even touch my css in svelte, the sprites and images I use there cannot be loaded in browser because their paths is not resolved by webpack compiler.

Or any idea how can I use this loader but still can use css in svelte with the some relative path images?

fsevenm avatar Aug 11 '20 07:08 fsevenm

Hi! Sorry for taking so long to come back at this... You fell in the cracks between holidays & back to work madness :sweat_smile:

I must confess I have never investigated much how emitCss could be supported... Could you share a synthetic example that illustrates what you want to achieve with emitCss and that works without HMR? I'm not using Webpack much with Svelte, so that would help troubleshooting the issue.

rixo avatar Oct 05 '20 18:10 rixo

It works for me if I follow the advice here. I'm using the mini-css-extract-plugin and added the lines described there to my webpack file (both the plugin and the loader).

I'm also able to use sass and typescript with svelte-preprocess. Thanks for this project.

jabuwu avatar Nov 27 '20 01:11 jabuwu

@jabuwu and you have emitCss: true and hotReload: true? Unfortunately I can't reproduce your solution, with my webpack5 config it still does not work - I get

node_modules/svelte-loader-hot/lib/virtual.js:74 if (storage.data instanceof Map) { ^ TypeError: Cannot read property 'data' of undefined

when switching on emitCss, and 404 not found in the console if I switch it off but have a relative path in inlined SCSS:

background-image: url(./subfolder/image.svg);

scrmea avatar Dec 09 '20 15:12 scrmea