-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
51 lines (50 loc) · 1.34 KB
/
build.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
const esbuild = require('esbuild');
const { copy } = require('esbuild-plugin-copy');
const { sassPlugin } = require('esbuild-sass-plugin');
esbuild
.build({
bundle: true,
minify: true,
entryPoints: [`src/index.js`],
outdir: `dist`,
tsconfig: `tsconfig.build.json`,
format: 'esm',
plugins: [
sassPlugin({
filter: /.scss$/,
type: 'lit-css',
}),
copy({
// this is equal to process.cwd(), which means we use cwd path as base path to resolve `to` path
// if not specified, this plugin uses ESBuild.build outdir/outfile options as base path.
resolveFrom: 'cwd',
assets: [
{
from: ['node_modules/pdfjs-dist/build/pdf.worker.min.js'],
to: ['dist/pdfjs-dist/build/pdf.worker.min.js'],
},
{
from: ['node_modules/pdfjs-dist/cmaps/*'],
to: ['dist/pdfjs-dist/cmaps/*'],
},
{
from: ['assets/fonts/*'],
to: ['dist/fonts/*'],
},
{
from: ['assets/style/font.css'],
to: ['dist/style/font.css'],
},
{
from: ['src/**/*'],
to: ['dist/src/'],
keepStructure: true,
},
],
}),
],
})
.catch(e => {
console.log(e);
process.exit(1);
});