-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuildConfigs.js
41 lines (37 loc) · 1.19 KB
/
buildConfigs.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
const { sassPlugin } = require("esbuild-sass-plugin");
const cssPlugin = require("esbuild-css-modules-plugin");
const { dependencies, devDependencies, peerDependencies } = require("./package.json");
const sharedConfig = {
bundle: true,
entryPoints: ["src/index.tsx", "src/ReactSearchNext.tsx", "src/useSearch.ts"],
logLevel: "info",
treeShaking: true,
minify: true,
// Removing source maps theoretically shaves around 200kb off the package size.
// Initially setting this to false and will verify the npm package size.
sourcemap: false,
external: [...Object.keys(dependencies), ...Object.keys(devDependencies), ...Object.keys(peerDependencies)],
target: ["es6", "node12.22.0"],
// css-text outputs CSS as a string which can be embedded as a stylesheet in a web component
// See for more info: https://github.com/glromeo/esbuild-sass-plugin?tab=readme-ov-file#type-css-text
plugins: [
cssPlugin(),
sassPlugin({
filter: /globals\.scss$/,
type: "style"
}),
sassPlugin({ type: "css-text" })
],
outdir: "./lib",
outbase: "./src"
};
module.exports = {
esm: {
...sharedConfig,
format: "esm"
},
cjs: {
...sharedConfig,
format: "cjs"
}
};