-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrollup.config.nodePolyfills.mjs
More file actions
29 lines (26 loc) · 1.12 KB
/
Copy pathrollup.config.nodePolyfills.mjs
File metadata and controls
29 lines (26 loc) · 1.12 KB
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
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import {dirname} from 'path';
import esbuild from 'rollup-plugin-esbuild'
import {fileURLToPath} from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
console.log('Rollup config for nodePolyfills ' + __dirname);
const outDir = 'build/resources/main/lib/enonic/polyfill-react4xp';
export default {
input: 'src/main/resources/lib/enonic/polyfill-react4xp/nodePolyfills.ts',
output: {
dir: outDir,
format: 'cjs',
preserveModules: false, // We want to bundle everything into one bundle, so this should be false!
},
// Some hooks are run in parallel but others, like the transform hook notably, are run in sequence, and the hooks are passed the result of the previous one.
plugins: [
nodeResolve(), // Resolves modules from node_modules (e.g. core-js internals)
commonjs(), // A Rollup plugin to convert CommonJS modules to ES6, so they can be included in a Rollup bundle
esbuild({
minify: process.env.NODE_ENV === 'production',
tsconfig: 'tsconfig.graal.json',
}),
]
};