Parcel: Generated bundle name does not include hash

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

馃悰 bug report

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.

馃帥 Configuration (.babelrc, package.json, cli command)

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();

馃 Expected Behavior


The generated bundle browser.js should include a hash.

馃槸 Current Behavior

Instead it's just browser.js.

馃拋 Possible Solution

馃敠 Context

馃捇 Code Sample

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.10.1
| Node | 10.11.0
| npm/Yarn | npm 6.4.1
| Operating System | macOS Mojave

Question

Most helpful comment

So, would it make sense to add such an option?

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings