Skip to content

Commit

Permalink
Simplidy rollup config
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Dec 15, 2019
1 parent 869e0cb commit 859ab76
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-decorators": "^7.4.0",
"@rollup/plugin-json": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.6.0",
"eslint": "^6.6.0",
Expand All @@ -34,6 +35,7 @@
"prettier": "^1.18.2",
"rollup": "^1.26.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^5.1.2",
Expand All @@ -42,7 +44,7 @@
"typescript": "^3.6.4"
},
"scripts": {
"start": "rollup -c rollup.config.dev.js --watch",
"start": "rollup -c --watch",
"build": "npm run lint && npm run rollup",
"lint": "eslint src/*.ts",
"rollup": "rollup -c"
Expand Down
24 changes: 0 additions & 24 deletions rollup.config.dev.js

This file was deleted.

56 changes: 39 additions & 17 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
import resolve from "rollup-plugin-node-resolve";
import typescript from "rollup-plugin-typescript2";
import babel from "rollup-plugin-babel";
import { terser } from "rollup-plugin-terser";
import typescript from 'rollup-plugin-typescript2';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
import serve from 'rollup-plugin-serve';
import json from '@rollup/plugin-json';

export default {
input: ["src/boilerplate-card.ts"],
output: {
dir: "./dist",
format: "es"
const dev = process.env.ROLLUP_WATCH;

const serveopts = {
contentBase: ['./dist'],
host: '0.0.0.0',
port: 5000,
allowCrossOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
plugins: [
resolve(),
typescript(),
babel({
exclude: "node_modules/**"
}),
terser(),
]
};

const plugins = [
nodeResolve({}),
commonjs(),
typescript(),
json(),
babel({
exclude: 'node_modules/**',
}),
dev && serve(serveopts),
!dev && terser(),
];

export default [
{
input: 'src/boilerplate-card.ts',
output: {
dir: 'dist',
format: 'es',
},
plugins: [...plugins],
},
];

0 comments on commit 859ab76

Please sign in to comment.