Skip to content

Commit 472c030

Browse files
committed
fix(player): inject cjs shims into plugins bundle
closes #1374
1 parent 8d90519 commit 472c030

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

packages/vidstack/.scripts/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function getPluginsBundles(): BuildOptions[] {
8787
...getBaseConfig({ dev: false, server: true }),
8888
entryPoints: ['src/plugins.ts'],
8989
outfile: 'dist-npm/plugins.js',
90+
inject: ['.scripts/cjs-shims.ts'],
9091
external: PLUGINS_EXTERNAL_PACKAGES,
9192
},
9293
];
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createRequire } from 'node:module';
2+
import path from 'node:path';
3+
import url from 'node:url';
4+
5+
globalThis.require = createRequire(import.meta.url);
6+
globalThis.__filename = url.fileURLToPath(import.meta.url);
7+
globalThis.__dirname = path.dirname(__filename);

0 commit comments

Comments
 (0)