generated from srmullen/stts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnowpack.config.js
52 lines (50 loc) · 1.4 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
const package = require('./package.json');
process.env.SNOWPACK_PUBLIC_PACKAGE_VERSION = package.version;
process.env.SNOWPACK_PUBLIC_SERVICE_WORKER = 'sw.js';
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
public: '/',
src: '/_dist_'
},
plugins: [
['@snowpack/plugin-svelte'],
['@snowpack/plugin-typescript'],
[
'@snowpack/plugin-webpack',
{
extendConfig: (config) => {
const { glob } = require("glob");
const { InjectManifest } = require('workbox-webpack-plugin');
const additionalManifestEntries = [
...glob.sync("*.{png,html,json,txt}", { cwd: './build' })
].map((e) => ({ url: e, revision: process.env.SNOWPACK_PUBLIC_PACKAGE_VERSION }));
config.plugins.push(
new InjectManifest({
"mode": "development",
"additionalManifestEntries": additionalManifestEntries,
"swSrc": "./_dist_/serviceWorker.js",
"swDest": process.env.SNOWPACK_PUBLIC_SERVICE_WORKER
})
);
return config;
},
},
]
],
packageOptions: {
"packageLookupFields": ["svelte", "module", "main"]
},
devOptions: {
port: 5000
},
buildOptions: {
/* ... */
},
routes: [
{ match: 'routes', src: '.*', dest: '/index.html' },
],
alias: {
"components": "./src/components"
}
};