Skip to content

Conversation

@myabc
Copy link
Contributor

@myabc myabc commented Oct 28, 2025

This PR fixes the issue where the build was generating index.js.js instead of index.js.

Changes

  • Changed fileName from 'index.js' to 'index' in vite.config.ts
  • Added entryFileNames: 'index.js' to rollup output options to ensure correct output filename

Problem

The npm package was including index.js.js in the dist folder, causing import resolution failures with esbuild and other bundlers.

Solution

Vite/Rollup automatically adds the appropriate extension based on the format, so we shouldn't include .js in the fileName. The entryFileNames option ensures the final output is exactly index.js.

Closes #24

- Changed fileName from 'index.js' to 'index' in vite.config.ts
- Added entryFileNames: 'index.js' to ensure correct output filename
- This prevents the build from generating index.js.js instead of index.js

Fixes knowledgecode#24
myabc added a commit to opf/openproject that referenced this pull request Oct 28, 2025
Provides support for jQuery-style event delegation.

Forked pending fix for knowledgecode/delegate#25
myabc added a commit to opf/openproject that referenced this pull request Oct 28, 2025
Provides support for jQuery-style event delegation.

Forked pending fix for knowledgecode/delegate#25
myabc added a commit to opf/openproject that referenced this pull request Oct 28, 2025
Provides support for jQuery-style event delegation.

Forked pending fix for knowledgecode/delegate#25
@knowledgecode
Copy link
Owner

Thank you so much for identifying and fixing this issue! 🙏

I wasn't aware of this problem because my application bundler (Vite) was resolving the incorrect filename automatically.

I've reviewed and tested your changes - the fix works perfectly! I'm happy to merge this PR.

One small note: Based on my testing, the entryFileNames: 'index.js' addition might not be necessary. Vite's lib.fileName option alone (without the .js extension) appears to generate the correct index.js output file. The rollupOptions.output.entryFileNames seems to override lib.fileName, which could potentially cause confusion in the future.

However, your solution works correctly and I really appreciate your contribution. I'll merge this as-is, and I may clean up the potentially redundant entryFileNames configuration in a follow-up commit.

Thanks again for taking the time to fix this and submit the PR! 🎉

@knowledgecode knowledgecode merged commit 074cad8 into knowledgecode:master Oct 29, 2025
1 check passed
myabc added a commit to opf/openproject that referenced this pull request Oct 29, 2025
Provides support for jQuery-style event delegation.

Forked pending fix for knowledgecode/delegate#25
myabc added a commit to opf/openproject that referenced this pull request Oct 29, 2025
Provides support for jQuery-style event delegation.

Forked pending fix for knowledgecode/delegate#25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundling issue: main script is index.js.js rather than index.js

2 participants