-
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
Id5 change breaks local build with webpack #10994
Comments
cc @smenzer |
Can I have some more info on how to reproduce? I tried this webpack config:
and this
but the build completes without error. |
Hi @dgirardi I messed up the configs 🙈 It's the ES5 build that fails. Here's how to reproduce package.json{
"name": "build-error",
"version": "2.0.0",
"description": "Oh no.. webpack",
"main": "index.ts",
"scripts": {
"build": "webpack --config webpack.config.js --mode=production"
},
"dependencies": {
"core-js": "3.24.1",
"prebid.js": "8.33.0",
"whatwg-fetch": "^3.6.2"
},
"devDependencies": {
"@babel/core": "^7.21.4",
"@babel/preset-env": "^7.21.4",
"babel-loader": "^9.1.2",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"webpack": "^5.79.0",
"webpack-cli": "^5.0.1"
}
} webpack config'use strict';
const path = require('path');
const prebidBabelConfig = require('prebid.js/.babelrc.js');
const babelPresetEnv = require('@babel/preset-env');
// 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+)
const babelConfig = {
loader: 'babel-loader',
options: {
...prebidBabelConfig,
presets: [
[
babelPresetEnv,
{
useBuiltIns: 'entry',
corejs: '3.24'
}
]
]
}
};
console.log(`>>>>>>>>>>>>>> COMPILE MODE: es5 <<<<<<<<<<<<<<`);
module.exports = (_, argv) => ({
name: 'es5 bundle',
mode: 'development',
devtool: argv.mode === 'production' ? false : 'inline-source-map',
target: ['web', 'es5'],
entry: {
moli_es5: './index.ts'
},
output: {
filename: argv.mode === 'production' ? `[name]_[chunkhash].min.js` : `[name].min.js`,
path: path.resolve(__dirname, 'dist'),
publicPath: ''
},
module: {
rules: [
{
test: /\.ts$/,
use: [
babelConfig,
{
loader: 'ts-loader',
options: { allowTsInNodeModules: false }
}
]
},
// this separate rule is required to make sure that the Prebid.js files are babel-ified. this rule will
// override the regular exclusion from above (for being inside node_modules).
{
test: /.js$/,
include: [/@highfivve/, new RegExp(`\\${path.sep}prebid\.js`)],
use: [babelConfig]
}
]
},
resolve: {
extensions: ['.ts', '.js', '.json']
}
}); index.tsimport 'core-js/features/object/from-entries';
import 'whatwg-fetch';
import 'core-js/es/promise';
import 'core-js/es/string/starts-with';
import 'core-js/es/object/assign';
import 'core-js/features/array/find';
import 'core-js/features/array/find-index';
import 'core-js/features/array/from';
import 'core-js/features/array/includes';
import 'core-js/features/object/from-entries';
import 'core-js/features/set';
import 'core-js/features/weak-set';
import 'core-js/features/string/includes';
import 'core-js/features/number/is-integer';
import prebid from 'prebid.js';
import 'prebid.js/modules/userId/index';
import 'prebid.js/modules/id5IdSystem';
prebid.processQueue(); |
Still unable to reproduce:
Here I assumed this tsconfig:
Then:
|
I once again made the mistake to trust Thanks for taking the time to look into this @dgirardi 🙏 |
Type of issue
Build failure
Description
@dgirardi , @pkowalski-id5 we are having build errors and I guess it might be related to this
export
here.This is the error we see
Steps to reproduce
This is our babelrc config
And our webpack config
Expected results
No build failure
Platform details
Other information
The text was updated successfully, but these errors were encountered: