sveltejs/template

setupTypeScript.js does does not add sveltePreprocess

AurelienRichez opened this issue · 0 comments

I noticed that the recent update to the rollup script (#185) broke the typescript conversion script because it uses the css: key as a marker to see where to add the sveltePreprocess.

while (( match = configEditor.exec(rollupConfig)) != null) {
if (foundCSS) {
const endOfCSSIndex = match.index + 1
rollupConfig = rollupConfig.slice(0, endOfCSSIndex) + ",\n preprocess: sveltePreprocess()," + rollupConfig.slice(endOfCSSIndex);
break
}
if (match[0].includes("css:")) foundCSS = true
}

Right now the workaround seems to be adding by hand preprocess: sveltePreprocess() in the rollup conf, below compilerOptions after running setupTypeScript.js.

Wouldn't it be simpler to have a patch file which is applied instead of a js script ? I'm not sure it would be more robust when changing the rollup file, but fixing it would probably be easier (just create a new patch file).