Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output file contains a temporary string #2

Closed
vijinpaulraj opened this issue Oct 25, 2020 · 4 comments
Closed

Output file contains a temporary string #2

vijinpaulraj opened this issue Oct 25, 2020 · 4 comments

Comments

@vijinpaulraj
Copy link

vijinpaulraj commented Oct 25, 2020

Hi - I'm trying parcel-plugin-concat to build my project with multiple entry files and everything seems to be working fine. The only issue is, the output file generates a random/temporary string in the suffix. As I include output.js in the index.html file, I want this exactly to be output.js. Is this something that can be fixed in the plugin?

parcel build src/js/* -o output.js --out-dir public/js

image

@tadayosi
Copy link
Owner

Thanks for the report. I noticed the issue; even with --no-content-hash parcel adds the content hash. Let's see if we can fix it.

@tadayosi
Copy link
Owner

@vijinpaulraj In fact the --no-content-hash parcel option does what you want. It still includes a hash in the output file, but it should be always the same as the hash is caculated based on the output path rather than the content. You are free to change output.<hash>.js to output.js afterwards. See: parcel-bundler/parcel#1934 (comment)

@vijinpaulraj
Copy link
Author

Thanks, @tadayosi for coming back on this.

The problem is, if I want to make a build for production, the renaming bit will be quite challenging - perhaps I need to write a script to rename the output file.

@tadayosi
Copy link
Owner

@vijinpaulraj With --no-content-hash the output file name should be always the same, so if you use npm scripts you can easily rename it as follows:

  "scripts": {
    ...
    "postbuild": "mv public/js/output.xxxxxxxx.js public/js/output.js"
  }

or you can use output.xxxxxxxx.js as-is at client as the hash code shouldn't change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants