You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm packaging WebTorrent so it can be used in a Chrome App environment. This is for the built-in torrent support in Brave Browser.
The "browser" field is automatically used during bundling, but for Chrome Apps I'd like to do different substitutions than for normal browser. Specifically, I'd like to use e.g. chrome-net instead of net since Chrome Apps have access to raw sockets, but normal browsers do not. Therefore, I cannot add this substitution to the 'browser' field without breaking the normal browser build.
What I really need is a way to specify what field name in package.json should be used for the browser field resolution, with "browser" being the default.
Fortunately, browser-resolve already support such an option! The browser option allows the user to select which property name to use from package.json. It defaults to "browser".
I'd like to update the existing config option browserField to accept a string value, e.g. { browserField: 'chromeapp' } for this exact purpose. Currently, this config option is only used to disable the browser field entirely, e.g.{ browserField: false }, so we can add a new string option relatively easily. I think this is cleanest.
What do folks think?
The text was updated successfully, but these errors were encountered:
FWIW, I just noticed that webpack accepts an aliasFields option that does exactly what I'm proposing for browserField here. Not that that's a reason in and of itself to support it. Just an additional data point.
I'm packaging WebTorrent so it can be used in a Chrome App environment. This is for the built-in torrent support in Brave Browser.
The "browser" field is automatically used during bundling, but for Chrome Apps I'd like to do different substitutions than for normal browser. Specifically, I'd like to use e.g.
chrome-net
instead ofnet
since Chrome Apps have access to raw sockets, but normal browsers do not. Therefore, I cannot add this substitution to the'browser'
field without breaking the normal browser build.What I really need is a way to specify what field name in
package.json
should be used for the browser field resolution, with"browser"
being the default.Fortunately,
browser-resolve
already support such an option! Thebrowser
option allows the user to select which property name to use frompackage.json
. It defaults to"browser"
.I'd like to update the existing config option
browserField
to accept a string value, e.g.{ browserField: 'chromeapp' }
for this exact purpose. Currently, this config option is only used to disable the browser field entirely, e.g.{ browserField: false }
, so we can add a new string option relatively easily. I think this is cleanest.What do folks think?
The text was updated successfully, but these errors were encountered: