-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathbuild-browser.mjs
More file actions
39 lines (38 loc) · 891 Bytes
/
build-browser.mjs
File metadata and controls
39 lines (38 loc) · 891 Bytes
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
/* eslint import/no-extraneous-dependencies: 0 */
import fs from 'fs';
import { rollup } from 'rollup';
import { babel } from '@rollup/plugin-babel';
import babelPresetEnv from '@babel/preset-env';
import pkg from "./package.json" with { type: "json" };
rollup({
input: 'src/index.js',
plugins: [
babel({
presets: [[babelPresetEnv, {
modules: false,
targets: {
node: '0.10',
ie: '11'
}
}]],
babelHelpers: 'bundled',
babelrc: false,
}),
],
})
.then((bundle) =>
bundle.write({
file: 'validator.js',
format: 'umd',
name: pkg.name,
banner: `/*!\n${String(fs.readFileSync('./LICENSE'))
.trim()
.split('\n')
.map((l) => ` * ${l}`)
.join('\n')}\n */`,
})
)
.catch((e) => {
process.stderr.write(`${e.message}\n`);
process.exit(1);
});