Skip to content

Commit 8d3962b

Browse files
authored
fix(vidstack): load CDN externals from jsDelivr (#1820)
1 parent b6eee75 commit 8d3962b

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

packages/vidstack/tsdown.config.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ const NPM_EXTERNAL_PACKAGES = [
2727
/^lit-html/,
2828
],
2929
CDN_EXTERNAL_PACKAGES = ['media-captions', 'media-icons', 'media-icons/element'],
30+
CDN_EXTERNAL_PATHS = {
31+
'media-icons': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/lazy.js/+esm',
32+
'media-icons/element': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.js/+esm',
33+
'media-captions': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/prod.js/+esm',
34+
},
3035
PLUGINS_EXTERNAL_PACKAGES = ['vite', 'rollup', /webpack/, /rspack/, 'esbuild', 'unplugin'];
3136

3237
if (!MODE_TYPES && MODE_WATCH) {
@@ -250,15 +255,7 @@ function defineCDNBundle({
250255
entryFileNames: (chunk: { name: string }) =>
251256
chunk.name === file ? `[name].js` : `[name]-[hash].js`,
252257
minifyInternalExports: false,
253-
paths: {
254-
'media-icons': legacy
255-
? 'https://cdn.jsdelivr.net/npm/media-icons@next/dist/lazy.js'
256-
: 'https://cdn.vidstack.io/icons',
257-
'media-captions': legacy
258-
? 'https://cdn.jsdelivr.net/npm/media-captions@next/dist/prod.js'
259-
: 'https://cdn.vidstack.io/captions',
260-
'media-icons/element': 'https://cdn.vidstack.io/icons',
261-
},
258+
paths: CDN_EXTERNAL_PATHS,
262259
codeSplitting: dev ? false : { groups: [{ name: 'frameworks', test: /node_modules/ }] },
263260
},
264261
plugins: [decorators() as any, !legacy && (rewriteCDNChunks(file) as any)].filter(

0 commit comments

Comments
 (0)