-
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
custom namespacing - use PrebidGlobal in the source code, replace it with pbjs as a webpack step #293
Conversation
…bjs (or anything else) with a webpack plugin. the name is configurable in package.json
By the way I won't be able to collect any stats on whether this breaks anything until tomorrow. |
update: I'm running this in production with a bunch of adapters and don't see any issues. |
@ojotoxy |
I tried a quick replace of |
What's the plan for this feature? I'd love to see it in the next release and am able to help with the code if there's a need. |
Thanks @nedstankus PRs are welcome. We stalled on this work and are at the point where the changes should be applied fresh to current master. The global var would need to be changed in all |
@ojotoxy |
I've ported these changes to v0.9 and submitted a new PR: |
The name "PrebidGlobal" was chosen as it's less likely to cause conflicts. A webpack step will convert every instance of that string with "pbjs" -- configurable in package.json .
Why do this with webpack instead of a gulp task? Because when running the tests with karma, only webpack is applied, no other operations that gulp is configured to apply.
Currently the tests only pass if the global name is configured to be 'pbjs'. That's because I did not rename all usages of pbjs to PrebidGlobal in the tests (yet). See this in the karma conf:
Is that going to apply webpack to all the test files that may need substitution?
Hope this helps.