You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have a custom transformer that generates HTML. It seems that parcel doesn't do normal post-processing of HTML if it came from this transformer. Following the guide, my transformer looks like this:
exportdefaultnewTransformer({asynctransform({asset,options}){// generates html from source filelethtml=awaitrunHtmeta(asset.filePath);letdeps=html.matchAll(/@(import)|(include)"(.*?)"/g);for(letdepofdeps){// Tried adding dependencies but it also doesn't workasset.addDependency({specifier: `./${dep}`,specifierType: 'kdl'});}// had to add this so the gen'd html is invalidated on source changeasset.invalidateOnFileChange(asset.filePath)asset.type='html';asset.setCode(html);// Return the assetreturn[asset];}});
I've noticed that it doesn't invalidate HTML deps like imported TS and CSS, despite knowing about them in the first build, which makes me always delete the generated files to invalidate the cache. However, the actual contents of the generated HTML do change.
I assume the generated HTML goes through the usual steps, as it does generate a dependency tree, but it seems that caching does not take this into account.
Am I doing something wrong? (Besides not setting a source map)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I have a custom transformer that generates HTML. It seems that parcel doesn't do normal post-processing of HTML if it came from this transformer. Following the guide, my transformer looks like this:
I've noticed that it doesn't invalidate HTML deps like imported TS and CSS, despite knowing about them in the first build, which makes me always delete the generated files to invalidate the cache. However, the actual contents of the generated HTML do change.
I assume the generated HTML goes through the usual steps, as it does generate a dependency tree, but it seems that caching does not take this into account.
Am I doing something wrong? (Besides not setting a source map)
Beta Was this translation helpful? Give feedback.
All reactions