-
-
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
WebExtension shouldn't rename options.html #8130
Comments
Hashing used to be disabled for every asset in web extensions but it caused a lot of issues with collisions, so we changed it. For options pages, you should definitely not need a static file name to open the page because you can simply do import optionsPage from 'url:./path/to/options.html';
// Do anything with the URL, e.g. open it
window.open(optionsPage, "_blank"); |
Would it be possible to add some option to disable hashing (revert to previous behaviour)? It's a bit annoying having to "import" URL for such assets. Also, I have a page that is accessible both from browser action popup and normal tab, so it would be nicer if the user sees the original/unhashed URL. |
It's actually probably for the best you have to import the URL because that is more robust against changes to the asset type, Parcel config, etc.
Don't extensions already show the massive, ugly extension ID before the file name? If you really need this it is possible by making a custom namer plugin. This also makes it possible to just use the original locations as URLs without importing them (though I do not recommend this). |
Unless In any case I feel that generally HTML pages should not be renamed though as they’re an app’s entry points: |
@fregante I forgot to say, I found a universal (and kinda obivious) way to do this: // @ts-expect-error: Parcel allow this
import optionsPage from "./options.html"
window.open(optionsPage, "_blank") |
Can you reopen the issue? This is still true:
|
By the way, if you want to preserve some filenames, you can specify them as "web_accessible_resources": ["options.html"] even as globs, like: "web_accessible_resources": ["*.html"] or "web_accessible_resources": ["**/*.html"] This has the obvious drawback that the files are now publicly available to the websites that your users visit. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
🙋 feature request
@parcel/config-webextension shouldn't rename the file options.html when it is mentioned inside the manifest.
🤔 Expected Behavior
The file
options.html
should keep it name in the dist folder.😯 Current Behavior
This file (as any other file) have its name changed, in this case to
options.COMMIT_SHA.html
.💁 Possible Solution
Don't rename the file from the field
options_ui.page
(insidemanifest.json
).🔦 Context
Many extensions have some way to open that file from JS, and the mangling make that inviable/impossible as the majority of the extensions support multiple browsers, and each browser have its own
options.html
.💻 Examples
The extension I was porting to Parcel uses the following code to open the options page:
The text was updated successfully, but these errors were encountered: