You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug?]: dev hmr error: "template2 is not a function"聽#1930
The use of $ServerOnly causes this issue. If you remove the $ServerOnly in examples/notes/src/app.tsx:14, examples/notes/src/components/SearchField.tsx:15
HMR works fine.
Of course if the browser ever tried to re-rerun it well you are in trouble.
So, by inference, it's probably not a good fit for HMR either.
While I recognize the intent of $ServerOnly from a performance perspective, I also consider that the benefits of HMR may outweigh the opportunity cost of performance improvements due to $ServerOnly, and that there may be other potential issues.
Therefore, I have prepared a commit that removes $ServerOnly from this example. (I have reserved judgment on the $ServerOnly that exists in archived_examples).
Should I replace this example? Or does anyone have another opinion?
Same issue here, randomly getting these errors until I comment out line by line and figure out which line causes this. Unfortunately, this makes solid quite hard to develop.
With solid-js@1.9.15, vite-plugin-solid@2.11.14, and babel-plugin-jsx-dom-expressions@0.40.10, a root $ServerOnly element hydrates normally but throws TypeError: template is not a function on the first HMR edit. Setting omitServerOnlyTemplates: false for the client HMR transform makes the same edit succeed.
So this remains open pending the Vite plugin integration; updating solid-js alone is not sufficient for this case.
Activity
brenelz commentedon Aug 4, 2025
Can verify this issue.
brenelz commentedon Aug 4, 2025
Do we know is it only the notes template? I tried downgrading and the same issue with HMR
drdxk commentedon Aug 4, 2025
fwiw, I was checking out some other templates and building something small off of the basic template and haven't seen that issue elsewhere
dennev commentedon Aug 5, 2025
The use of
$ServerOnlycauses this issue. If you remove the$ServerOnlyinexamples/notes/src/app.tsx:14,examples/notes/src/components/SearchField.tsx:15HMR works fine.
In the mentioned issue:
So, by inference, it's probably not a good fit for HMR either.
While I recognize the intent of
$ServerOnlyfrom a performance perspective, I also consider that the benefits of HMR may outweigh the opportunity cost of performance improvements due to$ServerOnly, and that there may be other potential issues.Therefore, I have prepared a commit that removes
$ServerOnlyfrom this example. (I have reserved judgment on the$ServerOnlythat exists inarchived_examples).Should I replace this example? Or does anyone have another opinion?
htndev commentedon Sep 3, 2025
I'm encountering the same issue in my pet project. Could you give some hints on where this problem stems from?
vladmiller commentedon Feb 2, 2026
Same issue here, randomly getting these errors until I comment out line by line and figure out which line causes this. Unfortunately, this makes solid quite hard to develop.
Langlw1992 commentedon Mar 11, 2026
Got the same issue. But i use @tanstack/solid-start ranther the solid-start
freakingeek commentedon Jul 15, 2026
I have the same issue. Still no fix?
vladmiller commentedon Jul 18, 2026
@Langlw1992 I've got the same issue on both tanstack/start and solid start
lxsmnsyc commentedon Jul 18, 2026
@vladmiller I'll check if we can transfer this to solid-refresh
birkskyum commentedon Aug 17, 2026
I reduced the remaining HMR failure to a standalone
vite-plugin-solidSSR reproduction and filed it upstream:With
solid-js@1.9.15,vite-plugin-solid@2.11.14, andbabel-plugin-jsx-dom-expressions@0.40.10, a root$ServerOnlyelement hydrates normally but throwsTypeError: template is not a functionon the first HMR edit. SettingomitServerOnlyTemplates: falsefor the client HMR transform makes the same edit succeed.So this remains open pending the Vite plugin integration; updating
solid-jsalone is not sufficient for this case.brenelz commentedon Oct 16, 2026
So this is just waiting on the solid-vite-plugin pr to get merged