-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
rollup.demo.config.mjs
39 lines (37 loc) · 1.27 KB
/
rollup.demo.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { createRequire } from 'node:module'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import nodeResolve from '@rollup/plugin-node-resolve'
import cssnano from 'cssnano'
import postcssImport from 'postcss-import'
import copy from 'rollup-plugin-copy'
import esbuild from 'rollup-plugin-esbuild'
import livereload from 'rollup-plugin-livereload'
import postcss from 'rollup-plugin-postcss'
import serve from 'rollup-plugin-serve'
import { prebundleAlias, prebundleConfig } from './rollup.prebundle.config.mjs'
const require = createRequire(import.meta.url)
const { compilerOptions } = require('./tsconfig.json')
export default [
prebundleConfig,
{
plugins: [
prebundleAlias,
json({ preferConst: true }),
esbuild({
minify: !process.env.ROLLUP_WATCH,
target: compilerOptions.target,
}),
nodeResolve(),
commonjs(),
postcss({
plugins: [postcssImport, cssnano({ preset: 'default' })],
}),
copy({ targets: [{ src: 'demo/public/**/*', dest: 'dist' }] }),
process.env.ROLLUP_WATCH && serve({ contentBase: 'dist' }),
process.env.ROLLUP_WATCH && livereload(),
],
input: ['demo/js/index.js'],
output: { dir: 'dist', format: 'iife', compact: true },
},
]