@discordjs/rest with Nextjs

I'm using @discordjs/rest in my Nextjs app inside app api folder, it works on dev perfectly fine, but when I try to build the app I just get:

> next build

Failed to compile.

805.js from Terser
Unexpected token: punc ({) [805.js:30255,10]
    at js_error (*:\*\*\node_modules\next\dist\compiled\terser\bundle.min.js:1:32780)
    at croak (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:43882)
    at token_error (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:43989)
    at unexpected (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:44055)
    at as_property_name (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:68487)
    at concise_method_or_getset (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:64746)
    at class_ (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:64098)
    at expr_atom (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:61955)
    at maybe_unary (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:71619)
    at expr_ops (*:\*\*\node_modules\node_modules\next\dist\compiled\terser\bundle.min.js:1:72615)


> Build failed because of webpack errors
   Creating an optimized production build  . ELIFECYCLE  Command failed with exit code 1.

Process finished with exit code 1
Was this page helpful?