mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
125 stars 41 forks source link

Server-side code should be compiled for Node.js target #2163

Open ziir opened 2 years ago

ziir commented 2 years ago

Somewhat related to:

At the moment, server-side code is compiled w/ Babel on the fly via @babel/register, while client-side code is compiled via babel-loader. For tests, all code is compiled via babel-jest transformer.

In all cases, the central Babel configuration file is used, which includes @babel/preset-env preset, leveraging the central .browserslistrc configuration file, which only lists browser targets today, regardless of compilation context or environment variables.

This leads to the server-side code being compiled for browser targets, whereas it runs in a Node.js context, which poses multiple issues on server-side code specifically:

This can be solved by either:

┆Issue is synchronized with this Jira Task

KevinMind commented 5 months ago

Old Jira Ticket: https://mozilla-hub.atlassian.net/browse/ADDFRNT-85