Skip to content

Conversation

@DavidReinberger
Copy link

@DavidReinberger DavidReinberger commented Apr 1, 2025

I've refactored the plugin to use Unplugin so it can be interoperable with other compilers and added support for Webpack/Rspack.

import.meta.webpackContext is used in webpack/rspack environments and parsed to expected module shape.

I've also added an example for rspack.

There are some issues during bundling caused by the fact that the examples and packages are using registry version of the package instead of the workspace version. However if you change it to workspace:* and dts file definitions in tsup.config.js to point to ../ instead of node_modules (for some reason on dev dist folders are not linked) it builds (but not type checks ) and you are able to run the example. I did not want to make these changes in the PR, since it is out of scope.

I've tested the refactor by utilising the mentioned modifications to package.json and tsup config. Both vite and webpack/rspack works as far as I can tell.

Also the change could be fully backwards compatible by swapping the default export to unplugin.vite.

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.

1 participant