2020-08-03 09:30:48 +02:00
|
|
|
// rollup.config.js
|
|
|
|
import commonjs from "@rollup/plugin-commonjs";
|
|
|
|
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
|
|
import json from "@rollup/plugin-json";
|
|
|
|
import builtins from "builtin-modules";
|
|
|
|
import pkg from "./package.json";
|
2020-08-05 21:00:36 +02:00
|
|
|
import sourcemaps from 'rollup-plugin-sourcemaps';
|
2020-08-03 09:30:48 +02:00
|
|
|
|
2021-06-17 17:40:42 +02:00
|
|
|
const nodeEntryPoint = {
|
|
|
|
input: "lib/index.node.js",
|
2020-08-03 09:30:48 +02:00
|
|
|
output: {
|
|
|
|
file: pkg.main,
|
|
|
|
format: "cjs",
|
2020-08-05 21:00:36 +02:00
|
|
|
sourcemap: true,
|
2020-08-03 09:30:48 +02:00
|
|
|
},
|
|
|
|
external: builtins,
|
|
|
|
plugins: [
|
|
|
|
nodeResolve({
|
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
|
2020-08-05 21:00:36 +02:00
|
|
|
sourcemaps(),
|
|
|
|
|
2020-08-03 09:30:48 +02:00
|
|
|
commonjs({
|
|
|
|
include: [/node_modules/, /dist/],
|
|
|
|
extensions: [".js"],
|
|
|
|
ignoreGlobal: false,
|
2020-08-05 21:00:36 +02:00
|
|
|
sourceMap: true,
|
2020-08-03 09:30:48 +02:00
|
|
|
}),
|
|
|
|
|
|
|
|
json(),
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2021-06-17 17:40:42 +02:00
|
|
|
const browserEntryPoint = {
|
|
|
|
input: "lib/index.browser.js",
|
|
|
|
output: {
|
|
|
|
file: pkg.browser[pkg.main],
|
|
|
|
format: "cjs",
|
|
|
|
sourcemap: true,
|
|
|
|
},
|
|
|
|
external: builtins,
|
|
|
|
plugins: [
|
|
|
|
nodeResolve({
|
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
|
|
|
|
sourcemaps(),
|
|
|
|
|
|
|
|
commonjs({
|
|
|
|
include: [/node_modules/, /dist/],
|
|
|
|
extensions: [".js"],
|
|
|
|
ignoreGlobal: false,
|
|
|
|
sourceMap: true,
|
|
|
|
}),
|
|
|
|
|
|
|
|
json(),
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
export default [
|
|
|
|
nodeEntryPoint,
|
|
|
|
browserEntryPoint
|
|
|
|
]
|
|
|
|
|