forked from ivkan/ts-ion-rangeslider
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
87 lines (77 loc) · 1.91 KB
/
rollup.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import _dts from "rollup-plugin-dts"
import _esbuild from "rollup-plugin-esbuild"
import postcss from "rollup-plugin-postcss"
const dts = _dts.default ?? _dts;
const esbuild = _esbuild.default ?? _esbuild;
import { style } from "./package.json"
const fileName = "ts-range-slider"
const commonConfig = {
external: id => !/^[./]/.test(id),
input: "src/index.ts",
output: {
name: "TsRangeSlider",
sourcemap: true
},
plugins: []
}
// ESM config
const esmConfig = Object.assign({}, commonConfig)
esmConfig.output = Object.assign({}, commonConfig.output, {
file: `dist/mjs/${fileName}.mjs`,
format: "esm"
})
esmConfig.plugins = [
...esmConfig.plugins,
esbuild()
]
// ESM prod config
const esmProdConfig = Object.assign({}, esmConfig)
esmProdConfig.output = Object.assign({}, esmConfig.output, {
file: `dist/mjs/${fileName}.min.mjs`,
sourcemap: false
})
esmProdConfig.plugins = [
...esmConfig.plugins,
esbuild({minify: true})
]
// UMD config
const umdConfig = Object.assign({}, commonConfig)
umdConfig.output = Object.assign({}, commonConfig.output, {
file: `dist/umd/${fileName}.js`,
format: "umd"
})
umdConfig.plugins = [
...commonConfig.plugins,
esbuild()
]
// Production config
const umdProdConfig = Object.assign({}, umdConfig)
umdProdConfig.output = Object.assign({}, umdConfig.output, {
file: `dist/umd/${fileName}.min.js`,
sourcemap: false
})
umdProdConfig.plugins = [
...umdConfig.plugins,
esbuild({minify: true})
]
export default [
esmConfig,
esmProdConfig,
umdConfig,
umdProdConfig,
{
input: "typings/index.d.ts",
plugins: [dts()],
output: {
file: `dist/typings/${fileName}.d.ts`,
format: "es"
}
},
{
input: "src/styles/main.less",
output: [{
file: style
}],
plugins: [postcss({extract: true, minimize: true})]
}
]