-
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
refactor (build: gulpfiles) speed up build by only included arg modules #4263
Conversation
I'm a bit confused by the prebid build...
This appears to build
This appears to build Shouldn't it instead:
The command will build the following files:
Prebid only appears to function when I use |
Ok I did some more digging here and see the following
This makes more sense, but it's still not quite what I want. There should be better separation and documentation so you know what you're building:
Going to update my PR for the above... ☝️ |
Why are you refactoring this? If I understand your goals perhaps I can help. To answer some of your questions:
Building with all adapters is the default. Using a These are not for direct import as they are not published to the NPM repository, only source files are published to NPM (in which case the dependent package is responsible for building).
For general context, the primary reason all source files are built and outputted is because a Prebid.js bundle can be created dynamically through concatenation which allows runtime bundling. If you were to concatenate |
@snapwich thanks for the reply. I’m going to close the pull request - here’s some feedback after I spent some more time with the gulpFile yesterday. For some background I maintain a fork with custom adapters that are not public. I publish prebid to an internal npm repository for I thought prebid 2.x was refactored to support importing prebid dependencies instead of needing to bundle them. But maybe it was intended to support imports internally? After a deep dive yesterday, I’m realizing prebid is webpacking core-js and adapters. This makes sense for bundles - but ultimately I want imports not bundles. The prebid bundle is 36k with no adapters, I’m wondering now how much of this is core-js polyfills that I’m double loading on sites. IMO the build system was a bit confusing
Your notes about prebid-core and processQueue are super helpful! Also thanks for the tip on prebid-packager, I didn’t know about it. |
@potench |
It was, there are instructions on how to use prebid as a direct npm dependency in the README.md.
You can see how much of it is core-js and polyfills by running The double-loading of polyfills is one of the primary reasons why we don't publish built files to NPM. By publishing the source files and allowing end users to import and bundle with their own webpack process, we're allowing webpack to optimize the entire bundle and de-dupe shared dependencies. We're also allowing the end user to choose not to bundle polyfills at all (if they only support modern browsers). |
@snapwich thanks again for the responses;
So, this is precisely where things get confusing, the readme says:
The first line is importing the bundled prebid.js that already includes adapters and core-js and prebid-core.js. With the current build process there isn't a way to generate |
Oh, maybe |
Type of change
Description of change
When a list of bid-adapters is supplied, only build prebid with those adapters. If no custom list of adapters is supplied, build prebid with all adapters.