Skip to content

Commit 80a0084

Browse files
authored
feat: hmr (#61)
* feat: hmr * fix: simplify hmr * feat: add hmr to plugin * chore: improve hmr in csr-with-base-components * chore: move tabs to a separate component * chore: changeset * chore: bump 4.1.0 * chore: update examples
1 parent 1c2a0e2 commit 80a0084

File tree

24 files changed

+313
-410
lines changed

24 files changed

+313
-410
lines changed

examples/csr-with-base-components/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
<link href="https://cdn.jsdelivr.net/npm/@salesforce-ux/[email protected]/assets/styles/salesforce-lightning-design-system.min.css" rel="stylesheet">
99
</head>
1010
<body>
11-
<script type="module" src="/src/main.js"></script>
11+
<script type="module" src="/src/main.ts"></script>
1212
</body>
1313
</html>

examples/csr-with-base-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"lwc": "^8.16.1",
1818
"typescript": "^5.8.2",
1919
"vite": "^6.2.1",
20-
"vite-plugin-lwc": "^4.0.2"
20+
"vite-plugin-lwc": "^4.1.0"
2121
}
2222
}

examples/csr-with-base-components/src/main.js renamed to examples/csr-with-base-components/src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ import "@lwc/synthetic-shadow";
22
import { createElement } from "lwc";
33
import App from "c/app";
44

5+
document.body.querySelector("c-app")?.remove();
6+
57
const elm = createElement("c-app", { is: App });
68
document.body.appendChild(elm);
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
<template>
22
<lightning-layout multiple-rows="true">
33
<lightning-layout-item padding="around-small" size="12">
4-
<c-header title="Vite + LWC" sub-title="csr with base components"></c-header>
4+
<c-header></c-header>
55
</lightning-layout-item>
66
<lightning-layout-item padding="around-small" size="12">
7-
<lightning-tabset variant="scoped">
8-
<lightning-tab label="Counter">
9-
<c-counter label="Counter"></c-counter>
10-
</lightning-tab>
11-
<lightning-tab label="Tab 2">
12-
Tab 2
13-
</lightning-tab>
14-
</lightning-tabset>
7+
<c-tabs></c-tabs>
158
</lightning-layout-item>
169
</lightning-layout>
1710
</template>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { LightningElement, api } from "lwc";
22

33
export default class Header extends LightningElement {
4-
@api title = "Title";
5-
@api subTitle = "Subtitle"
4+
@api title = "Vite + LWC";
5+
@api subTitle = "csr with base components"
66
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<template>
2+
<lightning-tabset variant="scoped">
3+
<lightning-tab label="Counter">
4+
<c-counter></c-counter>
5+
</lightning-tab>
6+
<lightning-tab label="Tab 1">
7+
Tab 1
8+
</lightning-tab>
9+
</lightning-tabset>
10+
</template>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { LightningElement } from "lwc";
2+
3+
export default class Tabs extends LightningElement {
4+
connectedCallback(): void {
5+
console.log("Tabs component connected");
6+
}
7+
}

examples/csr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
"lwc": "^8.16.1",
1616
"typescript": "^5.8.2",
1717
"vite": "^6.2.1",
18-
"vite-plugin-lwc": "^4.0.2"
18+
"vite-plugin-lwc": "^4.1.0"
1919
}
2020
}

examples/csr/src/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { createElement } from "lwc";
22
import App from "c/app";
3+
4+
document.body.querySelector("c-app")?.remove();
5+
36
const elm = createElement("c-app", { is: App });
47
document.body.appendChild(elm);

examples/csr/src/modules/c/app/app.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
will-change: filter;
55
transition: filter 300ms;
66
}
7+
78
.logo:hover {
89
filter: drop-shadow(0 0 2em #646cffaa);
910
}
11+
1012
.logo.lwc:hover {
11-
filter: drop-shadow(0 0 2em #42b883aa);
13+
filter: drop-shadow(0 0 2em #1798c1);
1214
}

0 commit comments

Comments
 (0)