sveltejs / sapper-template

Starter template for Sapper apps
703 stars 214 forks source link

Upgrade svelte-loader to 3.0.0 #308

Closed non25 closed 3 years ago

non25 commented 3 years ago

I'm not sure about HMR working out of the box, because it may need Webpack HMR plugin or dev server, which I'm not sure sapper provides. :thinking: Will add some commits later.

Fixes #307

non25 commented 3 years ago

Did some testing on sapper-template-webpack, everything seems working with svelte-loader 3.0.0, but enabling HMR results in the following error:

Module parse failed: 'import' and 'export' may only appear at the top level

It doesn't work because Webpack 4 uses acorn v6, which can't eat it up for some reason. I remember using resolutions in yarn to override acorn to be v7+.

Maybe it is worth it to explore Webpack 5 instead, because maintaining npm/yarn compatible resolutions/overrides for transitive deps is kinda fragile.

benmccann commented 3 years ago

I wouldn't spend a lot of time on anything Sapper related. I'd be just as happy to turn off HMR and call it a day

non25 commented 3 years ago

I've added comment on how to make it work. Better than nothing I guess. :roll_eyes: