-
Reiter, Christoph authored
Make rollup bundle the demo app by default and let the index.js point to the actual implementation. This way we can use the default entry point of the package when including it in other packages and don't have to reference specific files.
Reiter, Christoph authoredMake rollup bundle the demo app by default and let the index.js point to the actual implementation. This way we can use the default entry point of the package when including it in other packages and don't have to reference specific files.
rollup.config.js 1.31 KiB
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
import copy from 'rollup-plugin-copy';
import {terser} from "rollup-plugin-terser";
import json from 'rollup-plugin-json';
import replace from "rollup-plugin-replace";
import serve from 'rollup-plugin-serve';
const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
console.log("build: " + build);
export default {
input: 'demo.js',
output: {
file: 'dist/bundle.js',
format: 'esm'
},
plugins: [
resolve(),
commonjs(),
json(),
replace({
"process.env.BUILD": '"' + build + '"',
}),
postcss({
inject: false,
minimize: false,
plugins: []
}),
(build !== 'local') ? terser() : false,
copy({
targets: [
'index.html',
'favicon.ico',
'node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js',
'node_modules/@webcomponents/webcomponentsjs/bundles',
],
outputFolder: 'dist'
}),
(process.env.ROLLUP_WATCH === 'true') ? serve({contentBase: 'dist', host: '127.0.0.1', port: 8002}) : false
]
};