krisselden / ember-cli-optimize

MIT License
10 stars 3 forks source link

Support for overriding `acorn.parse` options like ecmaVersion? #8

Open kjoshi1988 opened 3 years ago

kjoshi1988 commented 3 years ago

As of today there is no support of overriding acorn.parse options. In the line no: https://github.com/krisselden/ember-cli-optimize/blob/master/lib/optimize.js#L27, only the content is passed to the acorn.parse and no overriding options are passed. This was also the reason why async/await was breaking earlier and there was no way to override the ecmaVersion so the acorn dependency was bumped. But with the acorn version bump, the ecmaVersion option is now required and the parse is throwing a warning(see https://github.com/acornjs/acorn/blob/master/acorn/src/options.js#L107). Currently it is defaulted to 2020 but this might stop working in future.

So I would recommend to provide support for overriding parse options, similar to eager option, like:

{
   eager: {},
   parse: {
      ecmaVersion: 9,
      .....
   }
}