Skip to content

Commit

Permalink
fix(deps): declare required deps for webpack build (#8411)
Browse files Browse the repository at this point in the history
When using Prebid.js as a NPM dependency and built with webpack, the
instructions are to use the babel configuration and plugins that are
provided by Prebid.

```
      {
        test: /.js$/,
        include: new RegExp(`\\${path.sep}prebid\\.js`),
        use: {
          loader: 'babel-loader',
          // presets and plugins for Prebid.js must be manually specified separate from your other babel rule.
          // this can be accomplished by requiring prebid's .babelrc.js file (requires Babel 7 and Node v8.9.0+)
          // as of Prebid 6, babelrc.js only targets modern browsers. One can change the targets and build for
          // older browsers if they prefer, but integration tests on ie11 were removed in Prebid.js 6.0
          options: require('prebid.js/.babelrc.js')
        }
      }
```

This seems to work just fine when using NPM or Yarn 1. However it is not
possible when using stricter settings or package managers that require
strict dependency declarations.

```
[webpack-cli] Failed to load '/Users/john.wright/Workspace/mung-app/webpack.config.js'
config [webpack-cli] Error: prebid.js tried to access
@babel/preset-env, but it isn't declared in its dependencies;
this makes the require call ambiguous and unsound.
```
  • Loading branch information
johngeorgewright authored May 12, 2022
1 parent 22b80a0 commit 737ef37
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 384 deletions.
Loading

0 comments on commit 737ef37

Please sign in to comment.