-
-
Notifications
You must be signed in to change notification settings - Fork 199
Open
Labels
Status: Waiting FeedbackNeeds feedback from the authorNeeds feedback from the author
Description
Hello,
I setup Encore to use svelte-loader
as such:
...
.addLoader({
test: /\.svelte$/,
loader: 'svelte-loader',
options: {
preprocess: sveltePreprocess(),
emitCss: true,
compilerOptions: {
css: true,
dev: !Encore.isProduction(),
customElement: true,
}
}
},
{
// required to prevent errors from Svelte on Webpack 5+, omit on Webpack 4
test: /node_modules\/svelte\/.*\.mjs$/,
resolve: {
fullySpecified: false
}
}
)
...
let config = Encore.getWebpackConfig()
config.resolve.mainFields = ['svelte', 'browser', 'module', 'main']
config.resolve.extensions = ['.mjs', '.js', '.svelte']
let svelte = config.module.rules.pop()
config.module.rules.unshift(svelte)
module.exports = config
Svelete works as expected if I disable customElement
options.
With this option enabled, I manage to have a working custom element, unless I use styles for nested component.
As I understand, it looks like not possible to style nested components inside it.
A workaround is to use :global
inside parent element, but with my configuration it doesn't work.
Is there a specific webpack config for it I failed ?
Thanks
Metadata
Metadata
Assignees
Labels
Status: Waiting FeedbackNeeds feedback from the authorNeeds feedback from the author