emberjs / ember-cli-babel

Ember CLI plugin for Babel
MIT License
153 stars 120 forks source link

Is there a way to opt out of ember-cli-babel entirely? #446

Open NullVoxPopuli opened 2 years ago

NullVoxPopuli commented 2 years ago

Related issue: https://github.com/babel/ember-cli-babel/issues/418

just wondering, given the inability to use custom babel plugins, or not transpile class properties, (and a bunch of other bugs (some as old as 2019!), that seems to have been the result of ecosystem complacency in this tool in that it is "good enough", but ultimately does too much (babel-wise)).

Eventually, given that I could eventually customize ember-cli-babel, I'd like to experiment with removing the ESM to AMD transform.

I know that addons can provide their own babel plugins / transforms, but, I don't think I'm at a point yet there addons' own configs even matter as I'm just trying to build the app and keep the Router in router.js as a native class with native properties, but today it looks like this:

 ;define("minimal-babel-demo/router", ["exports", "@ember/routing/router", "minimal-babel-demo/config/environment"], function (_exports, _router, _environment) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.default = void 0;

  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

  class Router extends _router.default {
    constructor(...args) {
      super(...args);

      _defineProperty(this, "location", _environment.default.locationType);

      _defineProperty(this, "rootURL", _environment.default.rootURL);
    }

  }

  _exports.default = Router;
  Router.map(function () {});
});

IF we could use custom bebel configs, then the above could be minimally,

 ;define("minimal-babel-demo/router", ["exports", "@ember/routing/router", "minimal-babel-demo/config/environment"], function (_exports, _router, _environment) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.default = void 0;

  class Router extends _router.default {
    location = _environment.default.locationType;
    rootURL = _environment.default.rootURL;
  }

  _exports.default = Router;
  Router.map(function () {});
});

Which is _significantly smaller, and should be way less boot time for apps as well.