-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snowpack.config.mjs
72 lines (69 loc) · 1.87 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
/** @type {import("snowpack").SnowpackUserConfig } */
const plugins = [
'@snowpack/plugin-react-refresh',
'@snowpack/plugin-dotenv',
['@snowpack/plugin-typescript'],
['@snowpack/plugin-run-script',
{
cmd: 'eslint src --ext .js,.jsx,.ts,.tsx',
watch: 'esw -w --clear src --ext .js,.jsx,.ts,.tsx'
},
],
'@snowpack/plugin-postcss',
['@snowpack/plugin-optimize',
{
preloadCSS: true,
preloadCSSFileName: '/style.css'
}
],
]
if (process.env.NODE_ENV === 'development')
plugins.push(['snowpack-plugin-hash'])
export default {
env: {
APP_NAME: process.env.npm_package_name,
VERSION: process.env.npm_package_version,
AUTHOR: process.env.npm_config_init_author_name,
DESCRIPTION: process.env.npm_package_description,
HOMEPAGE: process.env.npm_package_homepage,
REPOSITORY_URL: process.env.npm_package_repository_url,
COMMIT_HASH: process.env.GITHUB_SHA || 'development',
PUBLIC_URL: process.env.PUBLIC_URL || '/',
SPONSOR_URL: process.env.npm_package_funding_url,
BUILD_DATE: new Date().toISOString(),
},
alias: {
'@assets': './src/assets',
'@components': './src/components',
'@pages': './src/pages',
'@models': './src/models',
'@scripts': './src/scripts',
},
mount: {
public: { url: '/', static: true, resolve: true },
src: { url: '/static' },
},
plugins: plugins,
routes: [
/* Enable an SPA Fallback in development: */
// {"match": "routes", "src": ".*", "dest": "/index.html"},
],
optimize: {
splitting: true,
treeshake: true,
},
packageOptions: {
knownEntrypoints: [
'fp-ts/es6/Either'
],
},
devOptions: {
open: 'none',
tailwindConfig: './tailwind.config.js',
},
buildOptions: {
cacheDirPath: './.cache/snowpack',
metaUrlPath: 'snowpack', // Fix for github pages
// baseUrl: process.env.PUBLIC_URL || '/'
},
}