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

Math.pow operator ** breaks next build #1026

Closed
davibe opened this issue Feb 7, 2017 · 1 comment · May be fixed by lxndralbert/next.js#31
Closed

Math.pow operator ** breaks next build #1026

davibe opened this issue Feb 7, 2017 · 1 comment · May be fixed by lxndralbert/next.js#31

Comments

@davibe
Copy link
Contributor

davibe commented Feb 7, 2017

In node.js one can use ** operator instead of Math.pow. i.e.

> 2**3
8

I tried it in a react component and next.js works fine in dev mode but next build fails badly with UglyfyJS Syntax errors.

SyntaxError: Unexpected token: operator (*) [bundles/pages/product.js:48689,76]
    at /Users/dade/work/grocerest/grocerest-webapp/node_modules/next/dist/server/build/index.js:122:21
    at /Users/dade/work/grocerest/grocerest-webapp/node_modules/webpack/lib/Compiler.js:256:15
    at Compiler.emitRecords (/Users/dade/work/grocerest/grocerest-webapp/node_modules/webpack/lib/Compiler.js:351:37)
    at /Users/dade/work/grocerest/grocerest-webapp/node_modules/webpack/lib/Compiler.js:249:12
    at /Users/dade/work/grocerest/grocerest-webapp/node_modules/webpack/lib/Compiler.js:344:11
    at next (/Users/dade/work/grocerest/grocerest-webapp/node_modules/tapable/lib/Tapable.js:154:11)
    at Compiler.compiler.plugin (/Users/dade/work/grocerest/grocerest-webapp/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/Users/dade/work/grocerest/grocerest-webapp/node_modules/tapable/lib/Tapable.js:158:13)
    at Compiler.afterEmit (/Users/dade/work/grocerest/grocerest-webapp/node_modules/webpack/lib/Compiler.js:341:8)
    at Compiler.<anonymous> (/Users/dade/work/grocerest/grocerest-webapp/node_modules/webpack/lib/Compiler.js:336:14)
  errors:
   [ 'bundles/pages/product.js from UglifyJs\nSyntaxError: Unexpected token: operator (*) [bundles/pages/product.js:48689,76]',
...

My workaround was to use Math.pow(num1, num2) instead

@arunoda
Copy link
Contributor

arunoda commented Feb 7, 2017

I think we should support babel preset 2016. I'm on it.

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants