-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
65 lines (62 loc) · 1.99 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
import * as path from "path";
import nodeResolve from "@rollup/plugin-node-resolve";
import babel from "@rollup/plugin-babel";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "rollup-plugin-typescript2";
import { terser } from "rollup-plugin-terser";
import postcss from "rollup-plugin-postcss";
import postCssImport from "postcss-import";
import autoprefixer from "autoprefixer";
const EXTENSIONS = [".js", ".jsx", ".ts", ".tsx"];
const ROOT_PATH = path.join(__dirname);
const SRC_PATH = path.join(ROOT_PATH, "src");
const DIST_PATH = path.join(ROOT_PATH, "dist");
export default {
output: {
dir: path.join(DIST_PATH, "esm"),
indent: false,
strict: false,
exports: "named",
preserveModules: true
},
input: {
index: path.join(SRC_PATH, "index.js"),
icons: path.join(SRC_PATH, "components/Icon/Icons/index.ts"),
interactionsTests: path.join(SRC_PATH, "tests/interactions-utils.ts"),
testIds: path.join(SRC_PATH, "tests/test-ids-utils.ts")
},
external: [/node_modules/],
//external: [/node_modules\/(?!/@l3-lib/ui-style)(.*)/],
plugins: [
commonjs(),
nodeResolve({
extensions: [...EXTENSIONS, ".json", ".css"]
}),
typescript({
tsconfig: path.join(ROOT_PATH, "tsconfig.esm.json")
}),
babel({
babelHelpers: "bundled",
extensions: EXTENSIONS
}),
terser({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true
}
}),
postcss({
/**
* Normally, this plugin expects a local version of "node_modules" to be present, but since
* we're externalizing all "node_modules", it doesn't exist.
* This little hack makes sure we're using "node_modules" instead of what the plugin expects.
*/
inject(cssVariableName) {
return `import styleInject from 'style-inject';\nstyleInject(${cssVariableName}, { insertAt: 'top' });`;
},
plugins: [autoprefixer(), postCssImport()],
autoModules: true
})
]
};