-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
@rspack/plugin-html only providing simulated default export #2851
Comments
@ahabhgk cc |
@shawnmcknight Do you want to create a PR for this? |
I can, but I'm not sure there is a way to get the tsc compiler to support a cjs "default" export (i.e. Currently the lib is exporting the Alternatively, I believe I can make everything work with I believe those are the only two viable approaches due to limitations in tsc's compilation output. Any thoughts on which is preferable? |
I think use named exports is the right choice but it's definitely a breaking change, we will fix this when release 0.2.0 version |
System Info
System:
OS: Windows 10 10.0.19045
CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900H @ 2.50GHz
Memory: 17.15 GB / 31.73 GB
Binaries:
Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (112.0.1722.48)
Internet Explorer: 11.0.19041.1566
Details
Originally reported in #2795 but splitting into separate issue.
@rspack/plugin-html
ships with a cjs build but that cjs build only provides a simulated default export. That is, the exports object has adefault
property on it, butexports
itself is not assigned to anything:Using the are the types wrong tool, it will report:
Effectively, this doesn't allow for an expected esm import or cjs require. To use cjs one must:
and to use esm one must:
I'm guessing this syntax requirement is unintentional.
Reproduce link
No response
Reproduce Steps
Try using
@rspack/plugin-import
with either:or
If you try to
new HtmlRspackPlugin()
you will get an error about it not being constructable.The text was updated successfully, but these errors were encountered: