-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emitCss broken in v2 #56
Comments
Emotion does something similar. It generates
but it would be nice to see this solved by webpack and loaders. |
It seems that plugins can tap webpack's filesystem: webpack-virtual-modules. |
I've made a thing: kaisermann@f7e0634 (still have to make the test work...) . It's working on the example I sent you over twitter. The usage is something like: // webpack.config.js
const svelteWebpack = require('svelte-loader')
module.exports = {
...
module: {
rules: [
{
test: /\.html$/,
exclude: /node_modules/,
use: {
loader: svelteWebpack.loader,
options: {
emitCss: true
}
}
},
{
test: /\.css$/,
use: ['css-loader']
}
]
},
plugins: [
svelteWebpack.plugin,
]
}; Let's say you have |
I wasn't able to make it work with By adding But, even if hot realoding is working, I'm getting this Edit: Fixed. The error was occurring because the hot module plugin was being called twice (webpack.config.js and by webpack with the --hot flag). @Rich-Harris I'm not entirely sure, but I think this would fix #45 as well 🤔🤔 |
Fixed in 2.9 |
The
ast.hash
property was removed in v2, as we thought it wasn't being used anywhere (initially it was used for scoping styles, but then the scoping hash was generated from just the CSS rather than the entire component).Turns out it was being used in svelte-loader, to provide a filename for the temporary CSS file. So now we have a bundle of different components importing
svelte-undefined.css
, with predictable results — only one file matches that path.A temporary workaround is to disable
emitCss
.The easy fix would be to reinstate
ast.hash
, or (better) compute it here. But it would be nice to have a fix that also covered #45, which probably means writing the CSS files back into the source directory:I don't know if there's a way to clean up those files after webpack is done with them (or create them in some 'virtual' form so they don't clutter the filesystem in the first place?
The text was updated successfully, but these errors were encountered: