forked from hms-dbmi/vizarr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snowpack.config.js
54 lines (49 loc) · 1.11 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
/** @type {import("snowpack").SnowpackUserConfig } */
const pkg = require('./package.json');
// pkg version avaiable in app via import.meta.env.SNOWPACK_PUBLIC_PACKAGE_VERSION
process.env.SNOWPACK_PUBLIC_PACKAGE_VERSION = pkg.version;
module.exports = {
mount: {
public: '/',
src: '/_dist_',
},
plugins: [
'@snowpack/plugin-react-refresh',
'@snowpack/plugin-typescript',
],
packageOptions: {
rollup: {
plugins: [ resolveGeotiff() ],
},
},
devOptions: {
/* ... */
},
buildOptions: {
// change build dir to out/ (next.js compat)
out: 'out',
baseUrl: process.env.VIZARR_PREFIX || './',
},
alias: {
/* ... */
},
};
/*
* Custom Rollup Plugin for installing geotiff.js
*
* vizarr doesn't use geotiff component of viv.
* This plugin just creates an empty shim for
* top-level imports in viv during install by snowpack.
*/
function resolveGeotiff() {
return {
name: 'resolve-empty-geotiff',
async load(id) {
if (!id.includes('geotiff.js')) return;
return `
export const fromBlob = '';
export const fromUrl = '';
`;
},
}
}