Official svelte-loader now has HMR support 🎉
rixo / svelte-loader-hot Goto Github PK
View Code? Open in Web Editor NEWWebpack loader for svelte components with HMR support
Webpack loader for svelte components with HMR support
Official svelte-loader now has HMR support 🎉
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?
With hotReload: true
, the layout slot will not update when navigating to a different route. There is no problem with HMR when Svelte v3.24.0 is installed.
Unfortunatly, it doesn't seem like this is working at all with the electron setup I have going.
I'm just loading up a browser window right now and loading the webpack-dev-server's URL. everything loads up fine initially, but no changes are ever reflected. The page doesn't even refresh, but I can see that webpack is rebuilding with every change.
Here's the webpack config I'm using for some context.
And I am passing the --hot
flag to the dev server. Still nothing :(
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = renderConfig = {
entry: "./src/app/index.js",
output: {
path: path.join(__dirname, "/out/app/"),
publicPath: 'http://localhost:8080/out/app/',
filename: "bundle.js"
},
mode: "development",
target: "electron-renderer",
devServer: {
publicPath: '/',
hot: true,
overlay: true
},
module: {
rules: [
{
test: /\.css/,
exclude: /node_modules/,
use: ["style-loader", "postcss-loader"]
},
{
test: /\.svelte/,
include: path.resolve(__dirname, "src/app"),
exclude: /node_modules/,
use: {
loader: "svelte-loader-hot",
options: {
hotReload: true
}
}
},
{
test: /\.js/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
},
plugins: [new HtmlWebpackPlugin()]
};
``
With webpack
(following the template), attempt to update even the simplest component fails with Failed to init component
. More specifically: TypeError: "cmp.$capture_state is not a function"
.
This happens regardless of the value of optimistic
.
I just switched from svelte-loader to svelte-loader-hot and in my webpack config I set up svelte-loader with the preprocess option to parse some tailwind css syntax.
The preprocess works with svelte-loader but fails with svelte-loader-hot
When I remove the specific tailwind css syntax, svelte-loader-hot works and hot reload.
Is there a change in the preprocess option from svelte-loader to svelte-loader-hot ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.