-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
42 lines (38 loc) · 1008 Bytes
/
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
import _esbuild from 'rollup-plugin-esbuild';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import path from 'path';
import commonjs from '@rollup/plugin-commonjs';
const esbuild = _esbuild.default ?? _esbuild;
const importMetaUrlCurrentModulePlugin = () => {
return {
name: 'import-meta-url-current-module',
resolveImportMeta(property, { moduleId }) {
if (property === 'url') {
return `new URL('${path.relative(process.cwd(), moduleId)}', document.baseURI).href`;
}
return null;
}
};
};
const config = {
input: 'src_ts/app-shell.ts',
output: {
file: 'src/src/app-shell.js',
format: 'es',
inlineDynamicImports: true,
sourcemap: true,
compact: true,
},
onwarn(warning, warn) {
if (warning.code === 'THIS_IS_UNDEFINED') return;
warn(warning);
},
plugins: [
importMetaUrlCurrentModulePlugin(),
nodeResolve(),
commonjs(),
esbuild(),
],
preserveEntrySignatures: false
};
export default config;