-
Notifications
You must be signed in to change notification settings - Fork 0
/
snowpack.config.js
105 lines (93 loc) · 3.25 KB
/
snowpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const commonjs = require("@rollup/plugin-commonjs");
const { nodeResolve } = require("@rollup/plugin-node-resolve");
const { terser } = require("rollup-plugin-terser");
const css = require("rollup-plugin-css-only");
const builtins = require("rollup-plugin-node-builtins");
const production = !process.env.ROLLUP_WATCH;
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
public: { url: "/", static: true },
src: { url: "/dist" },
},
plugins: [
"@snowpack/plugin-svelte",
"@snowpack/plugin-dotenv",
"@snowpack/plugin-typescript",
// [
// "snowpack-plugin-rollup-bundle",
// {
// emitHtmlFiles: true,
// preserveSourceFiles: true,
// // equivalent to inputOptions.input from Rollup
// // entrypoints: "src/index.ts",
// entrypoints: "build/snowpacker/entrypoints/**/*.js",
// extendConfig: (config) => {
// // https://rollupjs.org/guide/en/#outputoptions-object
// config.outputOptions = {
// sourcemap: true,
// format: "iife",
// name: "app",
// file: "public/bundle.js",
// intro: "const global = window;",
// // intro: 'var global = typeof self !== undefined ? self : this;'
// };
// // https://rollupjs.org/guide/en/#inputoptions-object
// // config.inputOptions = { ... }
// // add plugins
// config.inputOptions.plugins.push(
// ...[
// // typescript(/*{ plugin options }*/),
// builtins(),
// // we'll extract any component CSS out into
// // a separate file - better for performance
// css({ output: "bundle.css" }),
// // If you have external dependencies installed from
// // npm, you'll most likely need these plugins. In
// // some cases you'll need additional configuration -
// // consult the documentation for details:
// // https://github.com/rollup/plugins/tree/master/packages/commonjs
// nodeResolve({
// browser: true,
// dedupe: ["svelte"],
// }),
// commonjs({ sourceMap: false }),
// // In dev mode, call `npm run start` once
// // the bundle has been generated
// // !production && serve(),
// // Watch the `public` directory and refresh the
// // browser on changes when not in production
// // !production && livereload("public"),
// // If we're building for production (npm run build
// // instead of npm run dev), minify
// production && terser(),
// ]
// );
// return config;
// },
// // public,
// },
// ],
],
routes: [
/* Enable an SPA Fallback in development: */
// {"match": "routes", "src": ".*", "dest": "/index.html"},
],
optimize: {
/* Example: Bundle your final build: */
// "bundle": true,
},
packageOptions: {
polyfillNode: true,
/* ... */
},
devOptions: {
open: "none",
// hmr: false,
/* ... */
},
buildOptions: {
/* ... */
clean: true,
},
};