parcel
parcel copied to clipboard
Can't resolve URL for extensionless binary file
🐛 bug report
I tried getting a URL for an extensionless binary file like this:
const binaryURL = new URL('../tessellations/64-64-64', import.meta.url);
🤔 Expected Behavior
I should get a URL pointing to the hosted copy of the file.
😯 Current Behavior
Instead I get an error:
Server running at http://localhost:8080
🚨 Build failed.
@parcel/core: Failed to resolve 'tessellations/64-64-64.bin' from './src/tessellation.ts'
.../src/tessellation.ts:21:29
20 |
> 21 | const downloadUrl = new URL('tessellations/64-64-64', import.meta.url);
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22 |
23 |
@parcel/resolver-default: Cannot load file './tessellations/64-64-64' in './src'.
💡 Did you mean '../tessellations/64-64-64'?
💡 Did you mean '../tessellations/64-64-4'?
💁 Possible Solution
@mischnic suggested that extensionless files might not resolve properly. When I added a .bin extension, everything worked as expected!
🔦 Context
I wanted to import some msgpack serialized triangle mesh data.
🌍 Your Environment
Using Parcel v2.2.1 with Node v18 on Arch Linux.
I am experiencing the same bug with text extensionless files, specifically I am trying to include my LICENSE file (linked through a footer) into the bundle. Like @micahscopes adding a .txt extension and then renaming the file is a workaround!