This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
rollup.config.demo.ts
73 lines (70 loc) · 1.95 KB
/
rollup.config.demo.ts
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { defineConfig } from 'rollup';
import path from 'path';
import scss from 'rollup-plugin-scss';
import serve from 'rollup-plugin-serve';
import alias from '@rollup/plugin-alias';
import babel from '@rollup/plugin-babel';
import replace from '@rollup/plugin-replace';
import { terser } from 'rollup-plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import livereload from 'rollup-plugin-livereload';
import typescript from '@rollup/plugin-typescript';
const isEnvDevelopment = process.env.NODE_ENV === 'development';
export default defineConfig({
input: 'demo/src/main.ts',
output: {
file: 'demo/dist/index.js',
format: 'iife',
sourcemap: true,
},
plugins: [
scss({
output: 'demo/dist/index.css',
sourceMap: true,
watch: ['demo/src/**'],
sass: require('sass'),
}),
replace({
preventAssignment: true,
__VUE_OPTIONS_API__: JSON.stringify(true),
__VUE_PROD_DEVTOOLS__: JSON.stringify(false),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
alias({
entries: {
'holiday-avatar': path.resolve(__dirname, 'src'),
},
}),
resolve(),
commonjs(),
//! @rollup/plugin-typescript will not use `tsconfig.json` by default.
//! Issue: https://github.com/rollup/plugins/issues/394
typescript(),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: ['@babel/preset-env', '@babel/preset-typescript'],
plugins: [
[
'@vue/babel-plugin-jsx',
{
optimize: true,
},
],
],
extensions: ['js', 'jsx', 'ts', 'tsx'],
}),
terser(),
isEnvDevelopment &&
serve({
contentBase: ['demo'],
port: 5000,
}),
isEnvDevelopment && livereload({ watch: 'demo' }),
],
watch: {
include: ['demo/src/**', 'src/**'],
exclude: 'node_modules/**',
},
});