refactor(rollup): dont serve example files for builds

This commit is contained in:
moklick
2021-01-11 11:07:11 +01:00
parent de81743350
commit e07ed90fe5
4 changed files with 214 additions and 89 deletions
+11 -7
View File
@@ -13,6 +13,9 @@ import libraryRollupConfig from './rollup.config.js';
const isProd = process.env.NODE_ENV === 'production';
const isTesting = process.env.NODE_ENV === 'testing';
const serveFiles = !isProd || isTesting;
const doLiveReload = !isProd && !isTesting;
const rollupConfig = {
input: ['example/src/index.js'],
output: [
@@ -41,13 +44,14 @@ const rollupConfig = {
commonjs({
include: 'node_modules/**',
}),
serve({
open: !isTesting,
port: 3000,
contentBase: 'example/public/',
historyApiFallback: true,
}),
!isTesting && livereload(),
serveFiles &&
serve({
open: true,
port: 3000,
contentBase: 'example/public/',
historyApiFallback: true,
}),
doLiveReload && livereload(),
],
};