-
Notifications
You must be signed in to change notification settings - Fork 8
/
analyze.server.mjs
39 lines (37 loc) · 1.11 KB
/
analyze.server.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 commonjs from '@rollup/plugin-commonjs'
import shim from '@rollup/plugin-esm-shim'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import { builtinModules } from 'module'
import { defineConfig } from 'rollup'
import { minify, swc } from 'rollup-plugin-swc3'
import { adapter, analyzer } from './dist/index.mjs'
const external = [...builtinModules, 'vite']
export default defineConfig([
{
input: {
cli: 'src/cli.ts',
index: 'src/server/index.ts'
},
external,
output: [
{ dir: 'analysis', format: 'esm', exports: 'named', entryFileNames: '[name].mjs', chunkFileNames: '[name]-[hash].mjs' },
{ dir: 'analysis', format: 'cjs', exports: 'named', entryFileNames: '[name].js' }
],
plugins: [
commonjs(),
nodeResolve(),
{
name: 'resolve-template',
resolveId(id) {
if (id === 'html.mjs') {
return { id: './dist/html.mjs' }
}
}
},
shim(),
swc({ sourceMaps: true }),
minify({ mangle: true, module: true, compress: true, sourceMap: true }),
adapter(analyzer())
]
}
])