-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Registering a custom global name when importing prebid.js as a module #3479
Comments
With the release of 2.0 I've added an option to the babel-plugin that writes the global. If you're using the loader instructions in the README, you should be able to pass the variable using the loader with something similar to the following: let options = require('prebid.js/.babelrc.js');
options.plugins[0] = [options.plugins[0], {
globalVarName: 'pbjs'
}];
...
// and then in webpack config
use: {
loader: 'babel-loader',
options: options
} |
@yonbeastie - Going to assume that snapwich has you covered here. Re-open as needed. |
@snapwich is there's any way to change this var from prebid_js_build_generator repo? I've really need to generate prebid.js with my own globalVarName. Is there's a way just to pass some ENV param, let's say for a Dockerfile..? Or if this requires some PR I'd be happy to contribute. |
Closing this issue, following here prebid/prebid-js-build-generator#15 |
Note for people still using this fix, as it was reworked in new Prebid.Js versions you will need to use something like : let options = require('prebid.js/babelConfig.js')({
globalVarName: 'pbjs'
});
...
// and then in webpack config
use: {
loader: 'babel-loader',
options: options
} |
Type of issue
Question and/or Feature Request
Description
I'm importing prebid.js as a module thanks to v1.38, which is awesome, thank you so much for implementing this.
I notice this registers
window.pbjs
, which becomes a problem if another instance of prebid is on the page of a different version, or with different bidders registered. To get around this previously, I'd set theglobalVarName
in package.json, but installing with npm seems to preclude this as a viable solution.Is there a good way to change the global name when using prebid.js as an npm module? I've written a script to be run during the app build process that renames the
globalVarName
in/node_modules/prebid.js/package.json
, but it's quite a hack.Platform details
[email protected]+
The text was updated successfully, but these errors were encountered: