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
syntheticNamedExports #60
Comments
Thanks for the information, wasn't aware at all! Seems like a very powerful feature. I think it should be very easy to replicate the feature for synchronous use cases (ie. CommonJS). When generating the file output, if
Asynchronous use cases (ie. instantiating WASM using streaming) would be a bit more complicated as it requires a live binding implementation, but it's not a design goal for Nollup at the moment due to the processing complexity of it. For the time being I think this will suffice, and will allow people to seamlessly use CommonJS. I'll update the example as well to remove usage of "namedExports". If there's any concerns with this approach let me know! 🙂 |
Initial implementation. Will be tidying it up with test cases and releasing soon. Works well with the example projects. |
Wow! That was fast 🙂 I think that the best would be to stop detecting exports in rollup-plugin-commonjs-alternate and maybe just append something like This would fix following code (taken from older version of validator, nowadays they have es modules):
This is currently broken in commonjs alternaternate because it keeps last two lines intact. But we can also wait what @rollup/plugin-commonjs comes up with - it would be great if it started working with nollup so that users don't have to change their configs |
Should be fixed in The reason for the new plugin is mostly due to difference of opinion in how different situations should be approached. For example, the official plugin does not support dynamic requires, which is necessary for HMR to work. Since Nollup isn't an official feature of Rollup or anything like that, it's not considered for the official plugin to support so they stub out dynamic requires and throw out an error. From their perspective, it's more user-friendly. Another reason is the ES module detection. React Hot Loader adds CJS requires to ES modules, which the official plugin doesn't support without significant changes and possible performance loss, and doesn't make sense for them to add if HMR isn't an official feature.
|
That makes sense. This is great improvement because biggest pain with using (r|n)ollup was having to configure namedExports manually. Thank you 🙂 |
Released in |
Rollup just released new option for plugins named syntheticDefaultExports. It allows for better implementation of commonjs plugin without need to manually specify named exports which I found to be the biggest obstacle to using rollup.
Link to rollup PR: rollup/rollup#3295
Creating this issue only to bring this option to your attention. Thanks for awesome project.
The text was updated successfully, but these errors were encountered: