sveltejs/rollup-plugin-svelte

version 7.0.0 `compilerOptions` breaks preprocess

jacobdalamb opened this issue ยท 10 comments

This is the repo I'm using with tailwindcss and sapper-rollup template from https://github.com/andrasbacsai/sapper-tailwind-starter. I ran npm run dev and got this error:
Screen Shot 2020-11-25 at 09 29 35

The current template in https://github.com/sveltejs/template, which can be converted to TypeScript mode, uses version 7 of this plugin as well as a preprocessor, and works fine. The official Sapper template hasn't been updated yet.

We obviously can't make any guarantees about any third party template. Updating to version 7 of this plugin won't be as simple as just updating your package.json (that's what it means to be a breaking change), and any updates will be the responsibility of the maintainers of that template.

You need to move the config keys into compilerOptions namespace inside your rollup.config.js file

svelte({
--  dev,
--  hydratable: true,
--  emitCss: true,
++ compilerOptions: {
++   dev,
++   hydratable: true,
++   emitCss: true,
++ },
  preprocess
}),

You have two of these โ€“ one in client and server options.

Here's a PR to upgrade sapper-template that you can use as an example: sveltejs/sapper-template#289

You need to move the config keys into compilerOptions namespace inside your rollup.config.js file

svelte({
--  dev,
--  hydratable: true,
--  emitCss: true,
++ compilerOptions: {
++   dev,
++   hydratable: true,
++   emitCss: true,
++ },
  preprocess
}),

You have two of these โ€“ one in client and server options.

yeah I did that in the repo.... also if I add emitCss: true, it doesn't recognize it

Most people read the repo before suggesting a solution

Most people don't include useless links in their report.
"I'm using X ... but not really"

I was able to reproduce this and saw a couple other people report it on Discord. Unfortunately, I'm not quite sure where the error is coming from. It's unclear to me that it's coming from rollup-plugin-svelte. Sapper's error messages are useless when running npm run dev and I can't reproduce this with npm run build, which means it's next to impossible to debug. I think I would advise just sticking to 6.0.0 for now and we'll make sure 7.0.0 works with SvelteKit. I don't really want to sink time into fixing Sapper's error handling when Sapper is going away

I was able to reproduce this and saw a couple other people report it on Discord. Unfortunately, I'm not quite sure where the error is coming from. It's unclear to me that it's coming from rollup-plugin-svelte. Sapper's error messages are useless when running npm run dev and I can't reproduce this with npm run build, which means it's next to impossible to debug. I think I would advise just sticking to 6.0.0 for now and we'll make sure 7.0.0 works with SvelteKit. I don't really want to sink time into fixing Sapper's error handling when Sapper is going away

wait what do you mean sapper is going away?

This looks to be an issue in Svelte core: sveltejs/svelte#5722