Files
test-repo/scripts/build/rollup.index.config.js
T
Lucas Azzola e5d6a4704f Automatically load plugins from package.json (#3624)
* Automatically load plugins from package.json

* Fix build by adding json extension

* Fixup misuse of options argument

* Rewire graceful-fs to fs

* Document graceful-fs issue

* Alias graceful-fs to fs in Rollup
2018-01-05 21:09:51 +11:00

36 lines
902 B
JavaScript

import baseConfig from "./rollup.base.config.js";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import json from "rollup-plugin-json";
import replace from "rollup-plugin-replace";
import * as path from "path";
const external = ["assert"];
if (process.env.BUILD_TARGET !== "website") {
external.push(path.resolve("src/common/third-party.js"));
}
export default Object.assign(baseConfig, {
entry: "index.js",
dest: "dist/index.js",
format: "cjs",
plugins: [
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
// See comment in jest.config.js
"require('graceful-fs')": "require('fs')"
}),
json(),
resolve({
preferBuiltins: true,
extensions: [".js", ".json"]
}),
commonjs()
],
external,
paths: {
[path.resolve("src/common/third-party.js")]: "./third-party"
}
});