Parcel: Parser doesn't recognise file extensions with multiple dots

Created on 4 Nov 2018  路  8Comments  路  Source: parcel-bundler/parcel

馃悰 bug report

I'd like to add a custom Asset for files with the extension .tpl.html. Since the Parser uses path.extname (see https://github.com/parcel-bundler/parcel/blob/1.x/src/Parser.js#L73), which does not support this use case, I'm unable to do so.

I'd consider this a bug. I'd be interested to hear the thoughts of the Parcel team as to whether you'd accept a PR to fix it?

馃 Expected Behavior

bundler.addAssetType('tpl.html', templateAssetPath); should use my asset class for files such as file.tpl.html.

馃槸 Current Behavior

bundler.addAssetType('tpl.html', templateAssetPath); uses the default HTML asset, as the extension 'appears' to be .html.

馃拋 Possible Solution

Use a library such as https://github.com/ruyadorno/path-complete-extname, or a cruder method.

Bug

All 8 comments

This will be supported in Parcel 2 since we will use globs to match asset types.

Good stuff. Thanks Devon. What's your feeling about an ETA? I'm migrating a large project over to Parcel, and would love to set expectations to the team.

I was hoping end of year but that might be too optimistic. Currently the core is getting close, but we still need to convert over all the built-in plugins, of which there are many. Perhaps the community can help out with that to speed it along. I hope to at least start releasing alphas soon.

Do you have a clear set of tasks and guidance for community contributions for v2? From my POV, the tickets at https://github.com/parcel-bundler/parcel/projects/5 require too much background knowledge for me to approach.

@devongovett
1.x is it still under maintenance?

Because I fixed some bug and what I thought was feature on our company project for version 1.10.3

@rambo-panda 1.x is still under maintenance yes.

@georgecrawford we will have more details soon, once the core is more fleshed out.

Isn't this the same issue as #1501?

Edit: This is the only solution I've seen, and it isn't great.

Yeah, it's a dupe. The suggestion by @DeMoorJasper at https://github.com/parcel-bundler/parcel/issues/1501#issuecomment-406008614 would work for me, as long as known extensions includes those that I register myself with addAssetType.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philipodev picture philipodev  路  3Comments

dsky1990 picture dsky1990  路  3Comments

donaldallen picture donaldallen  路  3Comments

dotdash picture dotdash  路  3Comments

jzimmek picture jzimmek  路  3Comments