-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.mjs
43 lines (41 loc) · 1.18 KB
/
rollup.config.mjs
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
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import copy from 'rollup-plugin-copy';
import { importMetaAssets } from "@web/rollup-plugin-import-meta-assets";
const rebaseDist = relPath => relPath.startsWith('../')
? relPath.substring(1)
: relPath;
export default [{
/* Library */
input: './src/fatfs.ts',
output: [{
file: './dist/fatfs.min.js',
format: 'umd',
name: 'fatfs-wasm',
sourcemap: true,
sourcemapPathTransform: rebaseDist
}, {
file: './dist/fatfs.min.mjs',
format: 'es',
name: 'fatfs-wasm',
sourcemap: true,
sourcemapPathTransform: rebaseDist
}],
external: ['node:path', 'node:url', 'node:fs/promises'],
plugins: [
typescript({
rootDir: './src'
}),
terser({
sourceMap: true
}),
importMetaAssets(),
copy({
targets: [
{ src: './README.md', dest: 'dist' },
{ src: './package.dist.json', dest: 'dist', rename: 'package.json' },
{ src: './src/fatfs.ts', dest: 'dist/src' }
]
})
]
}]