Skip to content
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

Replace uglify with terser to support ES6 output #6911

Closed
wants to merge 1 commit into from

Conversation

nanek
Copy link
Contributor

@nanek nanek commented Jun 1, 2021

Type of change

  • Build related changes

Description of change

Changing the babel presets-env browser target to just Chrome in the master branch will fail with an error.

[19:03:38] 'makeWebpackPkg' errored after 8.06 s
[19:03:38] GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected token: keyword «const»
File: /Users/kenan/scm/sd/Prebid.js/criteoBidAdapter.js
Line: 38
[19:03:38] 'build-bundle-prod' errored after 8.07 s
[19:03:38] 'build' errored after 8.13 s

uglify-js does not support ES6+. By switching to terser, builds of prebid can target es6 if desired.

Other information

https://github.com/terser/terser#why-choose-terser

@@ -29,6 +29,7 @@ module.exports = {
],
"plugins": [
path.resolve(__dirname, './plugins/pbjsGlobals.js'),
useLocal('babel-plugin-transform-object-assign')
useLocal('babel-plugin-transform-object-assign'),
useLocal('@babel/plugin-proposal-object-rest-spread')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not related to using terser, however this fixes other build errors thrown by webpackStream if you target just Chrome. @babel/plugin-proposal-object-rest-spread is part of babel/preset-env.

@ChrisHuie ChrisHuie self-requested a review June 2, 2021 07:31
@ChrisHuie ChrisHuie self-assigned this Jun 2, 2021
@ChrisHuie
Copy link
Collaborator

ChrisHuie commented Jun 2, 2021

@nanek looks like our tests didn't run on this pr but I can test it out in an updated dependency pr #6828 that is about to get merged. We are looking at upgrading webpack but it is taking a bit of effort to convert to a chunking plugin that is now built into webpack

@ChrisHuie
Copy link
Collaborator

closing as these changes have been added to #6828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants