Skip to content

Commit

Permalink
fix(player): inject cjs shims into plugins bundle
Browse files Browse the repository at this point in the history
closes #1374
  • Loading branch information
mihar-22 committed Aug 6, 2024
1 parent 8d90519 commit 472c030
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vidstack/.scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function getPluginsBundles(): BuildOptions[] {
...getBaseConfig({ dev: false, server: true }),
entryPoints: ['src/plugins.ts'],
outfile: 'dist-npm/plugins.js',
inject: ['.scripts/cjs-shims.ts'],
external: PLUGINS_EXTERNAL_PACKAGES,
},
];
Expand Down
7 changes: 7 additions & 0 deletions packages/vidstack/.scripts/cjs-shims.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { createRequire } from 'node:module';
import path from 'node:path';
import url from 'node:url';

globalThis.require = createRequire(import.meta.url);
globalThis.__filename = url.fileURLToPath(import.meta.url);
globalThis.__dirname = path.dirname(__filename);

0 comments on commit 472c030

Please sign in to comment.