forked from the-via/app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsnowpack.config.mjs
86 lines (82 loc) · 1.94 KB
/
snowpack.config.mjs
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
/** @type {import("snowpack").SnowpackUserConfig } */
import proxy from 'http2-proxy';
import path from 'path';
export default {
alias: {
src: './src',
},
mount: {
public: {url: '/', static: true},
src: {url: '/dist'},
},
plugins: [
'snowpack-plugin-json5',
'@snowpack/plugin-react-refresh',
'@snowpack/plugin-dotenv',
[
'@snowpack/plugin-typescript',
{
/* Yarn PnP workaround: see https://www.npmjs.com/package/@snowpack/plugin-typescript */
...(process.versions.pnp ? {tsc: 'yarn pnpify tsc'} : {}),
resolveJSONModule: true,
},
],
[
'@snowpack/plugin-webpack',
{
extendConfig: (config) => {
const cssModulesRule = config.module.rules.find(
(rule) =>
rule &&
rule.use &&
rule.use.find(
(use) =>
use &&
use.loader &&
use.loader.includes('css-loader') &&
use.options &&
use.options.modules,
),
);
if (cssModulesRule) {
cssModulesRule.use.unshift({
loader: path.resolve('./scripts/css-modules-fix.js'),
});
}
return config;
},
},
],
],
routes: [
/* Enable an SPA Fallback in development: */
// {"match": "routes", "src": ".*", "dest": "/index.html"},
{
src: '/api/.*',
dest: (req, res) => {
// remove /api prefix (optional)
return proxy.web(req, res, {
hostname: 'localhost',
port: 7071,
});
},
},
],
optimize: {
/* Example: Bundle your final build: */
bundle: false,
minify: false,
splitting: true,
target: 'es2018',
},
packageOptions: {
knownEntrypoints: ['react-is'],
/* ... */
},
devOptions: {
/* ... */
},
buildOptions: {
baseUrl: "/sonix-via-app"
},
};