-
Notifications
You must be signed in to change notification settings - Fork 2k
/
.fatherrc.js
45 lines (41 loc) · 1.19 KB
/
.fatherrc.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
import { writeFileSync } from 'fs';
import { join } from 'path';
import { version } from './package.json';
import globals from 'globals';
// generate version.ts
const versionFilePath = join(__dirname, './src/version.ts');
writeFileSync(versionFilePath, `export const version = '${version}';`);
// generate globals.ts
const globalsFilePath = join(__dirname, './src/sandbox/globals.ts');
writeFileSync(
globalsFilePath,
`// generated from https://github.com/sindresorhus/globals/blob/main/globals.json es2015 part
// only init its values while Proxy is supported
export const globalsInES2015 = window.Proxy ? ${JSON.stringify(
Object.keys(globals.es2015),
null,
2,
)}.filter(p => /* just keep the available properties in current window context */ p in window) : [];
export const globalsInBrowser = ${JSON.stringify(Object.keys(globals.browser), null, 2)};
`,
);
export default {
target: 'browser',
esm: 'babel',
cjs: 'babel',
umd: {
minFile: true,
sourcemap: true,
},
runtimeHelpers: true,
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'lodash',
libraryDirectory: '',
camel2DashComponentName: false,
},
],
],
};