Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#20] Support .mjs and .cjs file extension #19

Merged
merged 1 commit into from Apr 16, 2022
Merged

[#20] Support .mjs and .cjs file extension #19

merged 1 commit into from Apr 16, 2022

Conversation

cdauth
Copy link
Contributor

@cdauth cdauth commented Apr 16, 2022

I am publishing my ESM bundle with a .mjs file extension. My understanding of vitejs/vite#6827 is that this will become the default in Library Mode to ensure compatibility with Node.js.

Currently, vite-plugin-css-injected-by-js only injects CSS into files whose file name contains .js. This pull request changes the behaviour to inject CSS into files whose file name ends with .js, .cjs or .mjs.

If you have time, it would be nice if you could publish a new release including this change, as I am currently blocked by this in migrating my project to Vite. Thank you for this useful plugin!

Copy link
Owner

@marco-prontera marco-prontera left a comment

Choose a reason for hiding this comment

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

Hi, thank you so much for the PR. I understood the need, I only indicated 1 small change, just to be correct in the match to avoid possible problems in the future.

As soon as you can fix it I proceed with the merge and make the new release 😜

src/index.ts Outdated Show resolved Hide resolved
@marco-prontera marco-prontera linked an issue Apr 16, 2022 that may be closed by this pull request
@marco-prontera marco-prontera added the enhancement New feature or request label Apr 16, 2022
Copy link
Owner

@marco-prontera marco-prontera left a comment

Choose a reason for hiding this comment

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

Perfect!

@marco-prontera marco-prontera changed the base branch from main to develop April 16, 2022 12:35
@marco-prontera marco-prontera merged commit 7917088 into marco-prontera:develop Apr 16, 2022
@marco-prontera
Copy link
Owner

@cdauth The new version is published! Thanks for the collaboration 👍

@cdauth
Copy link
Contributor Author

cdauth commented Apr 16, 2022

That was fast, thank you!

@marco-prontera marco-prontera changed the title Support .mjs and .cjs file extension [#20] Support .mjs and .cjs file extension Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support .mjs and .cjs file extension
2 participants