svelte-esbuild bug reproduce conditions

when typescript({ content }) {} replacement is embedded into the automatic preprocessor, it fails with:

and

when replacement is wrapped in typescript() from svelte-preprocessor, functions normally.

this seems almost nonsensical but it's reproducible.

success

rollup.config.js

// import spp from "svelte-preprocess";
// import { typescript } from "svelte-preprocess"
// ...
preprocess: [
    typescript({
        typescript({ content }) {
            const { code, map } = transformSync(content, {
                loader: "ts",
            });
            return { code, map };
        }
    }),
    spp({
        typescript: false
    }),
],
// ...

fail

rollup.config.js

// import spp from "svelte-preprocess";
// ...
preprocess: [
    spp({
        typescript({ content }) {
            const { code, map } = transformSync(content, {
                loader: "ts",
            });
            return { code, map };
        }
    }),
],
// ...

run

git clone [email protected]:endigma/svelte-esbuild.git
cd svelte-esbuild

yarn install
yarn dev # or yarn build

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes