feat(org-chart): support standalone React integration and update guides
This commit is contained in:
1 parent
5acaf8a295
commit
b637f86631
19 files changed
+1455
-64
No files matched your search
@@ -18,7 +18,10 @@ await build({
|
||||
target: 'es2022',
|
||||
outDir: 'dist',
|
||||
minify: false,
|
||||
lib: { entry: path.join(root, 'src/index.ts'), formats: ['es'], fileName: () => 'index.js' },
|
||||
lib: {
|
||||
entry: { index: path.join(root, 'src/index.ts'), 'hm-dialog': path.join(root, 'src/hm-dialog.tsx') },
|
||||
formats: ['es'], fileName: (_format, name) => `${name}.js`,
|
||||
},
|
||||
rolldownOptions: {
|
||||
external: id => externals.some(dependency => id === dependency || id.startsWith(`${dependency}/`)),
|
||||
onwarn(warning, warn) {
|
||||
@@ -37,5 +40,8 @@ execFileSync(process.execPath, [
|
||||
'-p', path.join(root, 'tsconfig.build.json'),
|
||||
], { stdio: 'inherit' });
|
||||
|
||||
const entry = path.join(root, 'dist/index.js');
|
||||
await writeFile(entry, `"use client";\n${await readFile(entry, 'utf8')}`);
|
||||
for (const name of ['index', 'hm-dialog']) {
|
||||
const entry = path.join(root, `dist/${name}.js`);
|
||||
const content = await readFile(entry, 'utf8');
|
||||
await writeFile(entry, content.startsWith('"use client";') ? content : `"use client";\n${content}`);
|
||||
}
|
||||
Reference in new issue
Block a user