-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Opt-out of the hash-in-filename pattern for individual files #4553
Comments
I really need to finish up the docs....
The namer plugin is responsible for that (you just have to make sure that your bundle filenames/paths are still unique): parcel/packages/namers/default/src/DefaultNamer.js Lines 93 to 95 in 619cbaf
(For some context, the HTML dependency visitor sets Does that answer your question? In that case I would close this as a duplicate of #4320 |
I think, to close this, the developer would need to be able to opt out of hashing for a specific file. This could be via a plugin though, so if that's possible with plugins, but not documented, then this can be closed in favour of #4320. |
The use-case here is "I like my files to be hashed, except this one particular file". It's great that Parcel does this by default with SW and HTML, but I think this should be generally configurable, otherwise developers will need to wait for Parcel to add in exceptions for their particular case (if that even makes sense). The naming plugin looks like a good bet, but having to publish a project-specific plugin to NPM seems like an unacceptable barrier. Writing a general plugin would be ok if it could be configured project by project, but I can't see a way to provide plugins with configuration. |
(The namer is a very simple plugin type, so it's page is rather complete already: https://v2.parceljs.org/plugin-system/namer/ , though a more real-world example is planned))
-> #4321 We'll probably allow that because the current workaround of setting up a monorepo to have a plugin "package" doesn't provide any technical benefits compared to a local plugin (regarding caching).
The config-loading logic that powers babelrc/postcss/... in Transformers will be ported to all other plugin types as well, so caching would work correctly as well. (And generally, trying to prevent a |
Sounds good!
Fwiw, "zero config" was never a selling point to me. I read it as "Parcel will do what it wants, and if you want something different, good luck!" Parcel's selling point for me is that it's "web aware" throughout. It's understanding of HTML, CSS etc is first-class. |
Yeah, I listed to your recent HTTP203 episode. |
Closing this in favour of the issues for missing docs/local plugins... |
@jakearchibald So would a custom plugin that can override a specific bundlename and leave all other bundles to the default namer (https://v2.parceljs.org/plugin-system/namer/#overriding-names-for-specific-bundles) pass your test? For Rollup, you wrote that writing a plugin to do this is a "non-trivial effort". Is this because the problem is having to write a plugin itself or because Rollup's plugin architecture makes this hard to do? |
Rollup lets you control the naming of a file when you emit a chunk or asset, but if you aren't doing that (eg, the chunk is created by Rollup solved this by providing a callback for If I'm reading the docs correctly, it looks like https://v2.parceljs.org/plugin-system/namer/#overriding-names-for-specific-bundles would pass, as long as it can be used without publishing the plugin separately to npm. |
I really dont understand why parcel makes such simple things so complicated. |
🙋 feature request
Sometimes it might be desirable to not put a hash into the filename of a resource. Parcel already does this automatically for ServiceWorker, for example. I’d be great if, as a developer, I could also opt out of this behavior for other files.
💁 Possible Solution
Is this something that could be deferred to the plugin interface?
The text was updated successfully, but these errors were encountered: