ember-cli / ember-cli

The Ember.js command line utility.
https://cli.emberjs.com
MIT License
3.26k stars 1.16k forks source link

Build Error (UglifyWriter) 'return' outside of function #8251

Closed mapeveri closed 2 years ago

mapeveri commented 5 years ago

After run embe build --environment=production i have this issue:

Build Error (UglifyWriter)

'return' outside of function

Stack Trace and Error Report: /tmp/error.dump.b30ea78b6371081667862a3904960ded.log

With ember build, I do not have this problem.

rwjblue commented 5 years ago

Something in your codebase is invalid and throws an error when minified. Presumably the stack trace points you to more information about the error.

The reason it doesn't happen with ember build is that we don't run minfication there by default.

mapeveri commented 5 years ago

Hi @rwjblue, I understand. And how could I detect the error in my code?. Thanks!!

locks commented 2 years ago

We have switched from Uglify to Terser. Hopefully nowadays you get a better error message!

csprocket777 commented 9 months ago

Just got this today after searching for a solution:

Build Error (TerserWriter)

'return' outside of function

Stack Trace and Error Report: /var/folders/g1/pkdwgwq57135gknzdvy_h0tr0000gn/T/error.dump.accae8da8d25920654632765fface5cd.log
    "ember-auto-import": "^2.4.2",
    "ember-cli": "~4.7.0",
    "ember-cli-app-version": "^5.0.0",
    "ember-cli-babel": "^7.26.11",
    "ember-cli-code-coverage": "^1.0.3",
    "ember-cli-dependency-checker": "^3.3.1",
    "ember-cli-htmlbars": "^6.1.0",
    "ember-cli-inject-live-reload": "^2.1.0",
    "ember-cli-sass": "^11.0.1",
    "ember-cli-sri": "^2.1.1",
    "ember-cli-string-helpers": "^6.1.0",
    "ember-cli-terser": "^4.0.2",
    "ember-cli-typescript": "^5.1.1",
    "ember-cli-typescript-blueprints": "^3.0.0",
NullVoxPopuli commented 9 months ago

return outside of a function isn't valid javascript, so it's likely one of your libraries is causing will need to be updated, patched, or PR'd to.