-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
35 lines (32 loc) · 925 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
import esbuild from 'rollup-plugin-esbuild';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import path from 'path';
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(), resolve(), commonjs(), esbuild()],
preserveEntrySignatures: false
};
export default config;