[READ-ONLY] Mirror of https://github.com/probablykasper/svelte-template. Svelte + Vite + HMR + TypeScript + Preprocessor support
svelte template
0

Configure Feed

Select the types of activity you want to include in your feed.

Build to `build` instead of `public`

Kasper (Mar 10, 2021, 11:46 PM +0100) 86988029 35510cbd

+10 -20
+1 -1
.gitignore
··· 1 - /public/build/ 1 + /build/
+5 -10
README.md
··· 13 13 14 14 Limitations: 15 15 16 - - Sourcemaps are supported for `.ts` and `.svelte` files, but not for the preprocessors used inside `.svelte` files. 17 - - Linting for code-quality rules is not supported. 16 + - Source maps are supported for `.ts` and `.svelte` files, but not for the preprocessors used inside `.svelte` files 17 + - Linting for code-quality rules is not supported. Would need to use ESLint with eslint-plugin-svelte3, but that plugin needs to work with svelte-preprocess ([issue](https://github.com/sveltejs/eslint-plugin-svelte3/issues/10)) 18 18 19 19 ## Recommended VSCode extensions 20 20 ··· 22 22 - `syler.sass-indented` for Sass 23 23 - `esbenp.prettier-vscode` for Prettier 24 24 25 - ## Config 25 + ## Setup 26 26 27 - With this setup, `src/index.ts` is built and bundled into `public/build/`. If you want more entrypoints, add them to `experiments.optimize.entrypoints` in `snowpack.config.js`. 27 + `src/main.ts` is built and bundled into `build/bundle/`. 28 28 29 - If you want `src` and `public` to be built and copied to a folder like `dist`: 30 - 31 - 1. Change the properties `mount` and `buildOptions.out` in `snowpack.config.js` 32 - 2. Update `.gitignore` and the paths `public/index.html` 33 - 34 - To disable source maps/`.map` files for builds, disable `buildOptions.sourceMaps` in `snowpack.config.js`. 29 + To disable source maps, disable `buildOptions.sourceMaps` in `snowpack.config.js`. 35 30 36 31 ## Commands 37 32
+4 -9
snowpack.config.js
··· 1 1 /** @type {import("snowpack").SnowpackUserConfig } */ 2 2 module.exports = { 3 3 mount: { 4 - src: { url: '/' }, 4 + src: { url: '/bundle' }, 5 + public: { url: '/', static: true }, 5 6 }, 6 7 plugins: ['@snowpack/plugin-svelte', '@snowpack/plugin-typescript'], 7 8 devOptions: { ··· 10 11 output: 'stream', // disable clearing of terminal 11 12 }, 12 13 buildOptions: { 13 - out: './public/build', 14 + out: './build', 14 15 sourcemap: true, 15 16 clean: true, 16 17 }, 17 18 optimize: { 18 - entrypoints: ['src/index.ts'], 19 + entrypoints: ['src/main.ts'], 19 20 bundle: true, 20 21 target: ['chrome64', 'es2020'], 21 22 }, 22 23 } 23 - if (process.env.NODE_ENV === 'development') { 24 - module.exports.mount = { 25 - src: { url: '/build' }, 26 - public: { url: '/', static: true }, 27 - } 28 - }