Skip to content
This repository was archived by the owner on Jun 14, 2023. It is now read-only.
This repository was archived by the owner on Jun 14, 2023. It is now read-only.

Configs for esbuild and svelte #22

@loupgaroublond

Description

@loupgaroublond

Hey there,

I just figured out how to get svelte to work with esbuild, but lack the time to properly modify docs. Here's the tl;dr, though.

npm install --save-dev svelte svelte-preprocess @tsconfig/svelte esbuild-svelte

will install the bits

tsconfig.json changes remain mostly the same.

I did add a line

    "sourceMap": false,

which overrides the setting from svelte, to enable the inline source map. Still testing this specifically.

Lastly are changes for esbuild specifically. The plugin template has an esbuild.config.mjs, which I modified.

Like the guide that ships with the package, https://www.npmjs.com/package/esbuild-svelte, first you need

import esbuildSvelte from "esbuild-svelte";
import sveltePreprocess from "svelte-preprocess";

followed by:

	plugins: [
		esbuildSvelte({
			preprocess: sveltePreprocess(),
		}),
	]

for reference, this code was already included in my package.json:

	"scripts": {
		"dev": "node esbuild.config.mjs",
		"build": "node esbuild.config.mjs production"
	},

After that, everything just worked, and I was more surprised that it did at all than how easy it was :). Hope this info is useful to you, even if it accompanies no other documentation. Happy to fill in more details, if you reply here, though please note I don't always check email/messaging frequently, so it might be a day or 4 before I reply.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions