-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrollup.config.js
51 lines (46 loc) · 1.1 KB
/
rollup.config.js
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
import { defineConfig } from 'rollup';
import typescript from "@rollup/plugin-typescript";
import nodeResolve from "@rollup/plugin-node-resolve";
import serve from "rollup-plugin-serve";
import { terser } from 'rollup-plugin-terser';
const isDevelopment = process.env.ROLLUP_WATCH ? true : false;
const serveOptions = {
contentBase: ["./dist", "./"],
host: "0.0.0.0",
port: 3000,
headers: {
"Access-Control-Allow-Origin": "*",
},
};
const terserOptions = {
format: {
comments: false
}
};
export default defineConfig(
[
{
input: "src/main.ts",
output: {
file: "dist/swipe-navigation.js",
format: "es",
sourcemap: isDevelopment,
},
watch:{
chokidar: {
// Workaround for WSL2-based Docker
usePolling: true,
}
},
plugins: [
typescript({
sourceMap: isDevelopment,
outputToFilesystem: true,
}),
nodeResolve(),
// Serve or Uglify based on develop or release
isDevelopment ? serve(serveOptions) : terser(terserOptions),
]
},
]
);