Issue: if you have an array as rollup.js config, and when you modify component style, output CSS files are not updated.
import resolve from "@rollup/plugin-node-resolve";
import css from "rollup-plugin-css-only";
import svelte from "rollup-plugin-svelte";
import autoPreprocess from "svelte-preprocess";
const pages = ["foo", "bar"];
const plugins = [svelte({ preprocess: autoPreprocess() }), resolve(), css()];
export default pages.map(
(page) =>
/** @type {import('rollup').RollupOptions} */ ({
input: `src/${page}/index.js`,
output: {
dir: `public/dest/${page}`,
},
plugins,
})
);
Preparation:
npm ciTry:
npm run clean && npm starthttp://localhost:3000/foo.html and /bar.html thereHeader.svelte (e.g. change background-color from #000 to #999)/foo.html changed/bar.html looses its whole stylebundle.css was actually not output at this timeA plugin rollup-plugin-css-only doesn't seem to work for multiple inputs. Generating plugin instance for each input fixes this issue. This might affect bundle time.
- const plugins = [svelte({ preprocess: autoPreprocess() }), resolve(), css()];
+ const plugins = [svelte({ preprocess: autoPreprocess() }), resolve()];
/** @type {import('rollup').RollupOptions} */ ({
…
- plugins,
+ plugins: [...plugins, css()],
})