-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
39 lines (34 loc) 路 1.09 KB
/
Copy pathtsdown.config.ts
File metadata and controls
39 lines (34 loc) 路 1.09 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
30
31
32
33
34
35
36
37
38
39
import fs from 'node:fs';
import path from 'node:path';
import { defineConfig } from 'tsdown';
import { clientPlugins, getClientBundleDir } from './tsdown-utils.ts';
export default defineConfig({
attw: {
ignoreRules: ['cjs-resolves-to-esm'],
profile: 'esm-only',
},
entry: ['./src/{index,plugins,run}.ts'],
onSuccess: async () => {
// Copy client files to dist folder for runtime access
for (const pluginName of clientPlugins) {
const srcPath = getClientBundleDir(pluginName);
const destPath = path.resolve(
import.meta.dirname,
'dist',
'clients',
pluginName.slice('client-'.length),
);
if (fs.existsSync(srcPath)) {
fs.mkdirSync(path.dirname(destPath), { recursive: true });
fs.cpSync(srcPath, destPath, { recursive: true });
// replace core imports in client bundle
// const clientFiles = fs.readdirSync(destPath);
// for (const file of clientFiles) {
// replaceCoreImports(path.resolve(destPath, file));
// }
}
}
},
publint: true,
sourcemap: true,
});