-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
81 lines (79 loc) · 2.02 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import nodeResolve from '@rollup/plugin-node-resolve'
import common from '@rollup/plugin-commonjs'
import babel from '@rollup/plugin-babel'
import copy from 'rollup-plugin-copy'
import replace from '@rollup/plugin-replace'
import typescript from 'rollup-plugin-typescript2'
import postcss from 'rollup-plugin-postcss'
import autoprefixer from 'autoprefixer'
import tailwindcss from 'tailwindcss'
import json from '@rollup/plugin-json'
import tailwindConfig from './tailwind.config.js'
export default [
{
input: 'src/index.ts',
preserveEntrySignatures: false,
output: [
{
dir: 'lib',
format: 'es'
}
],
external: ['solid-js', 'solid-js/web', 'path', 'express', 'stream', 'vite', 'knex'],
plugins: [
replace({
preventAssignment: true,
values: {
'src/web/hydrate.tsx': 'public/js/hydrate.js',
__dirname: 'process.cwd()'
}
}),
nodeResolve({
preferBuiltins: true,
exportConditions: ['solid', 'node']
}),
typescript(),
common(),
postcss(),
json(),
babel({
babelHelpers: 'bundled',
presets: [['solid', { generate: 'ssr', hydratable: true }]],
extensions: ['.ts', '.js', '.jsx', '.tsx']
})
]
},
{
input: 'src/web/hydrate.tsx',
output: [
{
dir: 'lib/public/js',
format: 'esm'
}
],
preserveEntrySignatures: false,
plugins: [
nodeResolve({ exportConditions: ['solid'], browser: true, preferBuiltins: false }),
typescript(),
json(),
babel({
babelHelpers: 'bundled',
presets: [['solid', { generate: 'dom', hydratable: true }]],
extensions: ['.ts', '.js', '.jsx', '.tsx']
}),
common(),
postcss({
extensions: ['.css', '.module.css'],
plugins: [autoprefixer(), tailwindcss(tailwindConfig)]
}),
copy({
targets: [
{
src: ['public/*'],
dest: 'lib/public'
}
]
})
]
}
]