svelte-esbuild

Svelte Esbuild

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 git@gitlab.com:endigma/svelte-esbuild.git
cd svelte-esbuild

yarn install
yarn dev # or yarn build

Top categories

Loading Svelte Themes