Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,19 @@ export default defineConfig(async () => {
});

// Fix dayjs ES module issue from AppKit - merge configs properly
// Pre-bundle packages with CommonJS dependencies so Vite converts them to ESM
return {
...baseConfig,
optimizeDeps: {
...baseConfig.optimizeDeps,
include: [...(baseConfig.optimizeDeps?.include || []), "dayjs", "dayjs/locale/en", "dayjs/esm/locale/en"]
include: [
...(baseConfig.optimizeDeps?.include || []).filter(dep => dep !== 'phone'),
"dayjs",
"dayjs/locale/en",
"dayjs/esm/locale/en",
"socket.io-client",
"music-metadata"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The music-metadata package is being added to optimizeDeps.include but is not declared as a project dependency in package.json. This can lead to build failures in clean environments or unpredictable behavior if a transitive dependency version changes. To ensure a stable and predictable build, please add music-metadata to the dependencies in package.json.

]
}
};
Comment on lines 13 to 28

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and to avoid a long inline expression, you could extract the logic for filtering base dependencies into a constant. This makes the include array's composition clearer.

  // Fix dayjs ES module issue from AppKit - merge configs properly
  // Pre-bundle packages with CommonJS dependencies so Vite converts them to ESM
  const baseIncludes = (baseConfig.optimizeDeps?.include || []).filter(
    (dep) => dep !== "phone"
  );

  return {
    ...baseConfig,
    optimizeDeps: {
      ...baseConfig.optimizeDeps,
      include: [
        ...baseIncludes,
        "dayjs",
        "dayjs/locale/en",
        "dayjs/esm/locale/en",
        "socket.io-client",
        "music-metadata"
      ]
    }
  };

});