I am using the API and want to bundle directly a TypeScript file as an entry point instead of a HTML file. Unfortunately the generated bundle file does not include a hash. Though when I wrap my entry file in a HTML file and bundle that HTML file the bundle name has a hash included.
const Bundler = require('parcel-bundler');
const Path = require('path');
const entryFiles = Path.join(__dirname, './browser/index.ts');
const options = {
outDir: './target',
watch: false,
};
async function runBundle() {
const bundler = new Bundler(entryFiles, options);
const bundle = await bundler.bundle();
bundle.assets.forEach(({ name }) => console.log(name));
bundle.childBundles.forEach(({ name }) => console.log(name));
}
runBundle();
The generated bundle browser.js should include a hash.
Instead it's just browser.js.
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.10.1
| Node | 10.11.0
| npm/Yarn | npm 6.4.1
| Operating System | macOS Mojave
Entrypoints always maintain their filename. This is currently not configurable.
So, would it make sense to add such an option?
@lo1tuma probably, although I think naming config should be kept to a minimum as long as it's parcel 1, so not sure how this should be implemented.
Parcel 2 will allow you to define your own naming strategy, so that would definitely fix the issue...
Closed because it will be solved in Parcel 2.
Most helpful comment
So, would it make sense to add such an option?