Skip to content

Build system: Add CDN-based, Cross Origin Storage ready Prebid distribution#15329

Open
dgirardi wants to merge 8 commits into
masterfrom
cos
Open

Build system: Add CDN-based, Cross Origin Storage ready Prebid distribution#15329
dgirardi wants to merge 8 commits into
masterfrom
cos

Conversation

@dgirardi

@dgirardi dgirardi commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Type of change

  • Feature

Description of change

This adds some tooling to load prebid from a CDN in a way that should be compatible with cross origin storage. The build now generates:

  • prebid.web.js: this is intended as a drop-in replacement for the "normal" prebid.js bundle. Instead of being a concatenation of chunks selected with the build's --modules, it contains only the names and checksums of those chunks, and adds correspoding <script> tags to load them from a CDN (by default this is https://cdn.jsdelivr.net/npm/prebid.js@<version>/dist/chunks/, controllable with --distUrlBase).
    Note that the default distUrlBase points to a specific version only when building a tagged version (the version in package.json does not end with '-pre'). When building master it points to latest, which is unlikely to have matching checksums; the generated prebid.web.js would fail to load in that case.
  • bundle.js: this is intended to be loaded directly from a CDN. Once released, publishers should be able to load prebid with
      <script async src="https://cdn.jsdelivr.net/npm/prebid.js@<version>/dist/bundle.js?modules=<modules>"></script>
    it works first by loading a manifest file that contains chunk names, their checksum, and their dependencies; resolving the chunks needed for the given modules, then adding a <script> tag for each chunk.
    It supports setting the globalVarName and distUrlBase build options (e.g. bundle.js?globalVarName=customGlobal), but not defineGlobal, as a global variable is the only way to interact with Prebdi when loaded this way.

Other information

Closes #15256

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

This PR introduces changes that may not work on all browsers. According to Babel, the following polyfills may be needed, and they are not automatically included:

  • Changes to test/build-logic/web-bundler/manifest_spec.js may need:
    • es.array.push
  • Changes to test/spec/web-bundler/dependencies_spec.js may need:
    • es.array.push
  • Changes to test/spec/web-bundler/load_spec.js may need:
    • es.iterator.constructor
    • es.iterator.for-each
    • esnext.iterator.constructor
    • esnext.iterator.for-each

The best way to address this is to provide good test coverage, as normal PR checks run unit tests on older browsers.

Comment thread test/spec/web-bundler/load_spec.js Fixed
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Tread carefully! This PR adds 2 linter errors (possibly disabled through directives):

  • test/spec/web-bundler/load_spec.js (+2 errors)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02abf3244b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread web-bundler/options.mjs
Comment thread gulpfile.js Outdated
Comment thread web-bundler/buildOptionsInjector.mjs
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

This PR introduces changes that may not work on all browsers. According to Babel, the following polyfills may be needed, and they are not automatically included:

  • Changes to test/build-logic/manifest_spec.js may need:
    • es.array.push
  • Changes to test/spec/web-bundler/dependencies_spec.js may need:
    • es.array.push
  • Changes to test/spec/web-bundler/load_spec.js may need:
    • es.iterator.constructor
    • es.iterator.for-each
    • esnext.iterator.constructor
    • esnext.iterator.for-each

The best way to address this is to provide good test coverage, as normal PR checks run unit tests on older browsers.

@barecheck

barecheck Bot commented Jul 8, 2026

Copy link
Copy Markdown

Barecheck - Code coverage report

Total: 96.56%

Your code coverage diff: 0.00% ▴

Uncovered files and lines
FileLines
test/spec/web-bundler/load_spec.js74

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

This PR introduces changes that may not work on all browsers. According to Babel, the following polyfills may be needed, and they are not automatically included:

  • Changes to test/build-logic/manifest_spec.js may need:
    • es.array.push
  • Changes to test/spec/web-bundler/dependencies_spec.js may need:
    • es.array.push
  • Changes to test/spec/web-bundler/load_spec.js may need:
    • es.iterator.constructor
    • es.iterator.for-each
    • esnext.iterator.constructor
    • esnext.iterator.for-each

The best way to address this is to provide good test coverage, as normal PR checks run unit tests on older browsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

explore publishing a library to cross origin storage

1 participant