-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathrollup.config.js
More file actions
50 lines (47 loc) · 1.21 KB
/
rollup.config.js
File metadata and controls
50 lines (47 loc) · 1.21 KB
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
import resolve from "@rollup/plugin-node-resolve";
import babel from "@rollup/plugin-babel";
import packageJson from "./package.json";
import modulePackage from "module";
const input = ["src/index.ts", "src/webpack5.ts"];
const extensions = [".ts"];
export default {
input,
external: [...Object.keys(packageJson.dependencies), ...modulePackage.builtinModules, "webpack"],
onwarn: (warning) => {
if (warning.code === "CIRCULAR_DEPENDENCY") {
// Circular dependencies are usually not a big deal for us so let's just warn about them
console.warn(warning.message);
return;
}
// Warnings are usually high-consequence for us so let's throw to catch them
throw new Error(warning.message);
},
plugins: [
resolve({
extensions,
rootDir: "./src",
preferBuiltins: true,
}),
babel({
extensions,
babelHelpers: "bundled",
include: ["src/**/*"],
}),
],
output: [
{
dir: "./dist/esm",
format: "esm",
exports: "named",
sourcemap: true,
entryFileNames: "[name].mjs",
chunkFileNames: "[name].mjs",
},
{
dir: "./dist/cjs",
format: "cjs",
exports: "named",
sourcemap: true,
},
],
};