parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.45k stars 2.27k forks source link

Cascading Asset Types #1828

Closed tripodsan closed 4 years ago

tripodsan commented 6 years ago

🐛 bug report

I try to create plugin that pre-processes a HTML template (resolving references to CSS/JS, etc) and then converts it into a JS function. For that I created 2 asset types, where the first extends from HTMLAsset so that I don't need to duplicate the HTML parsing logic. I hoped to be able the tweak the type of the generated content, so that it is detected as my other asset, which then can generate the JS.

The original code is here: https://github.com/adobe/parcel-plugin-htl/pull/19 it used to work with 1.9.7, but it doesn't work as expected against master anymore.

I created some integration tests here: https://github.com/parcel-bundler/parcel/pull/1827

but they fail. it looks like the altered type is not re-inserted into the pipeline again.

🤔 Expected Behavior

The output of the HTLPreAsset should be detected as HTLAsset so that the correct output can be rendered.

😯 Current Behavior

The HTLAsset is never used.

mischnic commented 4 years ago

Parcel 2 has a revamped plugin system to allow "extending" existing asset types.