-
Notifications
You must be signed in to change notification settings - Fork 0
/
snowpack.config.js
60 lines (56 loc) · 1.41 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
const fs = require("fs");
const path = require("path");
let pkg;
if (fs.existsSync(path.resolve(process.cwd(), "../package.json"))) {
pkg = require("../package.json");
} else if (
fs.existsSync(path.resolve(process.cwd(), "../gh-pages.config.json"))
) {
pkg = require("../gh-pages.config.json");
} else {
pkg = require("./package.json");
}
process.env.SNOWPACK_PUBLIC_TITLE = pkg.name;
process.env.SNOWPACK_PUBLIC_DESCRIPTION = pkg.description;
process.env.SNOWPACK_PUBLIC_REPO = pkg.repository.url.replace(/^git\+/, "");
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
public: "/",
src: "/dist",
},
plugins: [
"@snowpack/plugin-babel",
"@snowpack/plugin-sass",
"snowpack-plugin-mdx",
/*["@snowpack/plugin-webpack",
{
sourceMap: false,
outputPattern: {
css: '[name].[contenthash].bundle.css',
js: '[name].[contenthash].bundle.js',
assets: '[name].[contenthash]',
},
},
],*/
],
routes: [
/* Enable an SPA Fallback in development: */
// {"match": "routes", "src": ".*", "dest": "/index.html"},
],
optimize: {
bundle: true,
minify: true,
target: "es2018",
},
packageOptions: {
knownEntrypoints: ["react/jsx-runtime"],
},
devOptions: {
/* ... */
},
buildOptions: {
baseUrl: pkg.baseUrl !== undefined ? pkg.baseUrl : "/",
out: "../docs",
},
};