-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
36 lines (29 loc) · 1.22 KB
/
rollup.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
import { nodeResolve } from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import terser from '@rollup/plugin-terser'
import piglet from './rollup_piglet.mjs'
const browser = {output: {}, plugins: []}
const node = {output: {}, plugins: []}
const lang = {output: {}, plugins: []}
browser.onwarn = node.onwarn = (e, warn) => (e.code === 'EVAL') ? "" : warn(e)
browser.input = 'lib/piglet/browser/main.mjs'
browser.output.file = 'dist/piglet.browser.mjs'
browser.plugins.push(nodeResolve(), terser({module: true, ecma: 2018}))
node.input = 'lib/piglet/node/main.mjs'
node.output.file = 'dist/piglet.node.mjs'
node.output.inlineDynamicImports = true
node.plugins.push(
nodeResolve(),
replace({
values: {
PIGLET_PACKAGE_PATH: 'path.join(createRequire(import.meta.url).resolve("piglet-lang"), "../../packages/piglet")'
},
preventAssignment: true
}),
terser({module: true, ecma: 2018})
)
// lang.input = 'lib/piglet/lang.mjs'
lang.input = 'packages/piglet/src/lang.pig'
lang.output.file = 'dist/lang.mjs'
lang.plugins.push(piglet(), terser({module: true, ecma: 2018}))
export default [lang] //[browser, node, lang]