-
Notifications
You must be signed in to change notification settings - Fork 69
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
Why does the plugin write declaration files directly? vs using emitFile
#180
Comments
As an additional, possibly obvious data point, if I just crudely replace the cx.emitFile({
type: "asset",
source: entry.text,
fileName: require("path").basename(fileName)
}) where |
I think this API didn't exist when the plugin was originally written (or I missed it completely). This does make a lot of sense though, feel free to make a PR. (If not, I'll fix it, eventually :)). |
Working on a PR, but for some random reason the filenames provided for emitted assets can not be relative or absolute paths (can only emit inside of Rollup's output dir), which makes it hard to respect the |
Looks like there is a problem with emitting files during If I track what was emitted and not emit it after first target, watch mode breaks (doesn't update types in all targets). Try running I fixed part of it in |
Strange. My own build process also uses multiple targets for a single bundle, and doesn't run into this error. It uses It does seem like the bundle object is reused between calls to But even when I pass the bundle object (second parameter to
|
Confusing stack trace is probably because of the way rollup consumes rollup.config.js -- those line numbers are completely bogus, you have to search by function names. I just tried adding a When I tried limiting emits here it kinda worked, but I see weird results in watch. When testing plugin's own build on your changes, first do If you get to the point where your changes can't do a successful build. reset with |
Okay, it seems that the bundle object passed to I've tried to get some feedback on this from the rollup devs but I'm not sure if that'll go anywhere. For now, maybe it makes sense to revert the original patch. |
This is apparently not intentional behavior in Rollup, see rollup/rollup#3174 |
emitFile
As opposed to using
emitFile
on the rollup context?The main issue I'm running into is that declarations aren't emitted at all when using the rollup API directly, because that calls the
generateBundle
hook withisWrite==false
. But more generally, it would be useful to have these in the return value fromgenerate
, so that I can feed them into a.d.ts
bundling tool.The text was updated successfully, but these errors were encountered: