forked from schteppe/cannon.js
-
Notifications
You must be signed in to change notification settings - Fork 133
/
rollup.config.js
47 lines (44 loc) · 1.16 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
import babel from '@rollup/plugin-babel'
import resolve from '@rollup/plugin-node-resolve'
import json from '@rollup/plugin-json'
import replace from '@rollup/plugin-replace'
import filesize from 'rollup-plugin-filesize'
const extensions = ['.ts']
const babelOptions = {
babelrc: false,
extensions,
exclude: '**/node_modules/**',
babelHelpers: 'bundled',
presets: [
[
'@babel/preset-env',
{
loose: true,
modules: false,
targets: '>1%, not dead, not ie 11, not op_mini all',
},
],
'@babel/preset-typescript',
],
}
export default [
{
input: `./src/cannon-es`,
output: { file: `dist/cannon-es.js`, format: 'esm' },
plugins: [json(), resolve({ extensions }), babel(babelOptions), filesize()],
},
{
input: `./src/cannon-es`,
output: { file: `dist/cannon-es.cjs.js`, format: 'cjs' },
plugins: [
json(),
resolve({ extensions }),
babel(babelOptions),
replace({
// Use node built-in performance.now in commonjs environments
'globalThis.performance': `require('perf_hooks') && require('perf_hooks').performance`,
}),
filesize(),
],
},
]