How to add bootstrap 5 and other global packages to a SvelteKit project?

Viewed 1098

I installed bootstrap using NPM

In a normal svelte project I usualy add bootstrap and other packages, which are used project wide, in the App.ts file. However, in a SvelteKit project there is no main entry point.

So what is the recommended way of adding bootstrap 5 or other packages to SvelteKit globally?

I don't want to use rollup plugins, but rather just want to import it as an module in JavaScript

2 Answers

You can make a top level __layout and import everything there.

I add this because this seems to be a good way for adding packages to a SvelteKit app.

https://github.com/svelte-add/svelte-add

If you want to add Bootstrap for example use

npx svelte-add@latest bootstrap

As of date of writing this, there are not alot of packages yet, hopefully that changes in the future.

Related