Inline music-metadata lazy loads to fix builds

This commit is contained in:
Jordan Eldredge 2025-07-04 10:38:48 -07:00
parent 1ba58c81e1
commit b5bf64a55d
2 changed files with 9 additions and 3 deletions

View file

@ -44,6 +44,9 @@ const BUNDLES = [
file: "built/webamp.bundle.js",
format: "umd",
name: "Webamp",
// music-metadata uses dynamic imports, so we need to inline them
// to avoid issues with the UMD build.
inlineDynamicImports: true,
},
},
{
@ -54,6 +57,9 @@ const BUNDLES = [
file: "built/webamp.bundle.min.js",
format: "umd",
name: "Webamp",
// music-metadata uses dynamic imports, so we need to inline them
// to avoid issues with the UMD build.
inlineDynamicImports: true,
},
},
{
@ -63,6 +69,9 @@ const BUNDLES = [
output: {
file: "built/webamp.bundle.min.mjs",
format: "module",
// music-metadata uses dynamic imports, so we need to inline them
// to avoid issues with the UMD build.
inlineDynamicImports: true,
},
},
];

View file

@ -23,9 +23,6 @@ export function getPlugins({ minify, outputFile, vite }) {
// https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency
// TODO: We could offer a version which does not inline React/React-DOM
nodeResolve(),
// Needed for music-metadata-browser in the Webamp bundle which depends upon
// being able to use some polyfillable node APIs
nodePolyfills(),
typescript({
compilerOptions: {
jsx: "react-jsx",