Skip to content

Commit

Permalink
Split rollup config for development/production
Browse files Browse the repository at this point in the history
  • Loading branch information
thegecko committed Jan 4, 2020
1 parent c60540e commit 9129041
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"scripts": {
"build": "rollup -c && typedoc src",
"watch": "rollup -c -w"
"watch": "rollup -c -w --config rollup.dev.config.js"
},
"engines": {
"node": ">=8.14.0"
Expand Down
13 changes: 2 additions & 11 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import builtins from "rollup-plugin-node-builtins";
import typescript from "rollup-plugin-typescript2";
import { terser } from "rollup-plugin-terser";
import sourceMaps from "rollup-plugin-sourcemaps"
import serve from "rollup-plugin-serve";
import livereload from "rollup-plugin-livereload";

const name = "DAPjs";
const pkg = require('./package.json')
const watch = process.env.ROLLUP_WATCH;

export default {
input: "src/index.ts",
Expand All @@ -27,7 +24,7 @@ export default {
}
],
plugins: [
!watch && del({
del({
targets: [
"dist/*",
"types/*"
Expand All @@ -41,12 +38,6 @@ export default {
useTsconfigDeclarationDir: true
}),
terser(),
sourceMaps(),
watch && serve({
contentBase: ".",
open: true,
openPage: "/examples/daplink-flash/web.html",
}),
watch && livereload()
sourceMaps()
]
};
52 changes: 52 additions & 0 deletions rollup.dev.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import del from "rollup-plugin-delete";
import tslint from "rollup-plugin-tslint";
import builtins from "rollup-plugin-node-builtins";
import typescript from "rollup-plugin-typescript2";
import { terser } from "rollup-plugin-terser";
import sourceMaps from "rollup-plugin-sourcemaps"
import serve from "rollup-plugin-serve";
import livereload from "rollup-plugin-livereload";

const name = "DAPjs";
const pkg = require('./package.json')
const watch = process.env.ROLLUP_WATCH;

export default {
input: "src/index.ts",
output: [
{
file: pkg.main,
format: "umd",
sourcemap: true,
name
},
{
file: pkg.module,
format: "esm",
sourcemap: true
}
],
plugins: [
!watch && del({
targets: [
"dist/*",
"types/*"
]
}),
tslint({
throwOnError: true
}),
builtins(),
typescript({
useTsconfigDeclarationDir: true
}),
terser(),
sourceMaps(),
watch && serve({
contentBase: ".",
open: true,
openPage: "/examples/daplink-flash/web.html",
}),
watch && livereload()
]
};

0 comments on commit 9129041

Please sign in to comment.