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

Issue8141/support safari extensions #8175

Merged

Conversation

Kjoep
Copy link
Contributor

@Kjoep Kjoep commented May 31, 2022

↪️ Pull Request

Adapt parcel js runtime to also support safari extensions.
Fixes #8141

💻 Examples

Any webextension build with parcel that uses getBundleUrl/getBaseUrl/getOrigin should now function.

🚨 Test instructions

This can only be tested by building a webextension and running it on safari. Note that to do this, you need to package the webextension as an OSX application using xcode.

In your extension, add an asset (let's say test.png). Then add code as follows to your content script:

    import icon32 from '~/assets/test.png';
    const icon = document.createElement('img');
    icon.src = browser.runtime.getUrl;
    document.querySelector('body').appendChild(icon);

this should add the test image to the document body when your extension is applied (i.e. the import resolves to a safari-web-extension:// url at runtime).

Copy link
Member

@101arrowz 101arrowz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for the most part, just a few questions.

packages/configs/webextension/package.json Outdated Show resolved Hide resolved
Before we were able to determine the bundle url for chrome and firefox extensions.
This fix also supports safari.
@Kjoep Kjoep force-pushed the issue8141/support_safari_extensions branch from 6b82317 to c063a45 Compare June 1, 2022 07:23
@mischnic mischnic merged commit f9ac612 into parcel-bundler:v2 Jun 7, 2022
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

Successfully merging this pull request may close these issues.

Support safari webextensions in runtime-js
3 participants