Skip to content

Commit

Permalink
Add watch-build script for debugging (#84)
Browse files Browse the repository at this point in the history
* Add build:watch script for debugging.

* Self review
  • Loading branch information
joeldenning authored Jul 22, 2020
1 parent 1acb6fc commit 4294a8a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
],
"scripts": {
"build": "rollup -c",
"watch-build": "rollup -cw",
"test": "jest --config jest.json",
"watch-tests": "jest --watch --config jest.json",
"format": "prettier --write './**/*'",
Expand Down
24 changes: 14 additions & 10 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import babel from "@rollup/plugin-babel";
import { terser } from "rollup-plugin-terser";

const shouldMinify = process.env.ROLLUP_WATCH !== "true";

export default [
{
input: "src/single-spa-react.js",
Expand All @@ -27,7 +29,7 @@ export default [
sourcemap: true,
},
],
plugins: [babel({ babelHelpers: "bundled" }), terser()],
plugins: [babel({ babelHelpers: "bundled" }), shouldMinify && terser()],
},
{
input: "src/single-spa-react.js",
Expand All @@ -38,10 +40,11 @@ export default [
},
plugins: [
babel({ babelHelpers: "bundled" }),
terser({
ecma: 6,
module: true,
}),
shouldMinify &&
terser({
ecma: 6,
module: true,
}),
],
},
{
Expand Down Expand Up @@ -73,7 +76,7 @@ export default [
sourcemap: true,
},
],
plugins: [babel({ babelHelpers: "bundled" }), terser()],
plugins: [babel({ babelHelpers: "bundled" }), shouldMinify && terser()],
external: ["single-spa-react", "react"],
},
{
Expand All @@ -85,10 +88,11 @@ export default [
},
plugins: [
babel({ babelHelpers: "bundled" }),
terser({
ecma: 6,
module: true,
}),
shouldMinify &&
terser({
ecma: 6,
module: true,
}),
],
external: ["single-spa-react", "react"],
},
Expand Down

0 comments on commit 4294a8a

Please sign in to comment.