-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
39 lines (36 loc) · 968 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
import esbuild from 'rollup-plugin-esbuild';
import resolve from '@rollup/plugin-node-resolve';
import path from 'path';
import commonjs from '@rollup/plugin-commonjs';
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,
},
onwarn(warning, warn) {
if (warning.code === 'THIS_IS_UNDEFINED') return;
warn(warning);
},
plugins: [
importMetaUrlCurrentModulePlugin(),
resolve(),
esbuild(),
commonjs(),
],
preserveEntrySignatures: false
};
export default config;