Wrapped plugin not working #475
Labels
kind: support
Asking for support with something or a specific use case
solution: Rollup behavior
This is Rollup's behavior and not specific to this plugin
solution: workaround available
There is a workaround available for this issue
Troubleshooting
Does
tsc
have the same output? If so, please explain why this is incorrect behaviorDoes your Rollup plugin order match this plugin's compatibility? If not, please elaborate
Can you create a minimal example that reproduces this behavior? Preferably, use this environment for your reproduction
What happens and why it is incorrect
I didn't answer the previous questions because I don't think this is a bug but probably a misuse of mine, but I don't understand what I'm doing wrong so I came here just asking help.
I pasted below my rollup config. There I'm using this plugin to transpile regular ts files and it works like a charm. Then I use
transformRiotTypescript
that leverages this same plugin just for some specific files.Here the implementation of my plugin:
As you can see, I use the plugin as it is just overriding the
transform
function and thename
.So I expect it to work the same, but it actually doesn't work well in watch mode.
It does use the content of the files at the first load, and at each new build it doesn't update it, so the resulting transformed code is always the same as the first build.
That seemed weird to me since the "non-wrapped" plugin worked good.
After a bit (or not so bit >.>) of debugging I noticed that each build, the function
buildStart
is invoked and theservicesHost
is created again losing all the versions, that then are set to 1 that is the same version of the previous build so it returns the same source file and doesn't update the content.I worked around this behavior overriding the
buildStart
in my wrapping plugin as follows:Doing so the plugin update the content correctly and it works very well.
Now: if the
buildStart
hook is invoked also for the "non-wrapped" plugin why don't they behave the same? Am I doing something that breaks the plugin?Environment
Versions
:rollup.config.js
The text was updated successfully, but these errors were encountered: