Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simiraaaa/test-svelte-build-for-vanilla
`<script src="./build.js"></script>`
https://github.com/simiraaaa/test-svelte-build-for-vanilla
Last synced: about 1 month ago
JSON representation
`<script src="./build.js"></script>`
- Host: GitHub
- URL: https://github.com/simiraaaa/test-svelte-build-for-vanilla
- Owner: simiraaaa
- License: unlicense
- Created: 2024-02-21T01:44:51.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-04T10:00:59.000Z (10 months ago)
- Last Synced: 2024-03-26T23:20:28.464Z (9 months ago)
- Language: HTML
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# build-for-vanilla-svelte-test
The purpose of this repository is to load a built Svelte component using a script tag.
``
## vite.config.js
https://github.com/simiraaaa/test-svelte-build-for-vanilla/blob/main/vite.config.js
## setup
```
npm i```
## build & check
```
npm run build
```### Check only umd.cjs
```
open ./test.html
```### Check es & umd
```
npx http-server
```and open `http://127.0.0.1:port/test.html` in your browser.
## development
```
npm run dev
```## memo
- https://vitejs.dev/guide/build.html#library-mode
- https://stackoverflow.com/questions/75832641/how-to-compile-svelte-3-components-into-iifes-that-can-be-used-in-vanilla-js
- Unable to utilize aliases in svelte.config.js. For example, `$lib`.## log
```
npm create svelte@latest```
```
┌ Welcome to SvelteKit!
│
◇ Where should we create your project?
│ (hit Enter to use current directory)
│
◇ Directory not empty. Continue?
│ Yes
│
◇ Which Svelte app template?
│ Library project
│
◇ Add type checking with TypeScript?
│ Yes, using JavaScript with JSDoc comments
│
◇ Select additional options (use arrow keys/space bar)
│ none
│
└ Your project is ready!```
```
npm i
``````
git init && git add -A && git commit -m "Initial commit"
```...