Newer
Older
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import {terser} from "rollup-plugin-terser";
import serve from 'rollup-plugin-serve';
Bekerle, Patrizio
committed
import consts from 'rollup-plugin-consts';
import del from 'rollup-plugin-delete';
const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
console.log("build: " + build);
export default {
input: (build != 'test') ? ['src/dbp-notification.js', 'src/dbp-notification-demo.js'] : glob.sync('test/**/*.js'),
output: {
Bekerle, Patrizio
committed
dir: 'dist',
entryFileNames: '[name].js',
chunkFileNames: 'shared/[name].[hash].[format].js',
format: 'esm',
sourcemap: true
},
plugins: [
Bekerle, Patrizio
committed
del({
targets: 'dist/*'
}),
consts({
environment: build,
}),
Bekerle, Patrizio
committed
url({
limit: 0,
emitFiles: true,
fileName: 'shared/[name].[hash][extname]'
(build !== 'local' && build !== 'test') ? terser() : false,
copy({
targets: [
Bekerle, Patrizio
committed
{src: 'assets/index.html', dest: 'dist'},
{src: 'assets/favicon.ico', dest: 'dist'},
]
}),
(process.env.ROLLUP_WATCH === 'true') ? serve({contentBase: 'dist', host: '127.0.0.1', port: 8002}) : false
]
};