[Bug] browserslist and targets have no effect on the output of the build (potential performance problems as well)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- babel, javascript
- Área
- build-system, performance
Línea de trabajo
Comienza con los pasos mínimos para reproducirlo: añade la configuración de browserslist y la dependencia a package.json, y después ejecuta ember build -e production. Compara el archivo my-app.js generado con los archivos input.js y output.js enlazados, incluido el error del método privado. Se considera completado cuando los destinos de Chrome y Firefox configurados conservan la sintaxis nativa compatible y evitan la transformación inesperada mostrada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Originally reported here: https://github.com/emberjs/ember.js/issues/19790
🐞 Describe the Bug
After some investigation here: https://stackoverflow.com/questions/69547969/with-babel-how-do-i-not-compile-away-class-properties-since-browsers-support
And a minimal babel repro here: https://github.com/NullVoxPopuli/babel-transpilation-tests
I expect that setting my targets to last 1 firefox versions would allow me to keep native class properties. and only transpile what is decororated.
I believe fixing this could provide a bit of a boost to everyone's build times. Today all class properties are transpiled to a time when class properties were not implemented in the browser).
🔬 Minimal Reproduction
- ember new my-app
- cd my-app
- remove safari from targets, leaving only
last 1 Chrome versionsandlast 1 firefox versions - add browserslist to package.json
- add browserslist as devDependency
yarn browserslist --update-db- run
ember build -e production - in the my-app.js, I expect all occurrences of
rootURLto be involved in an assignment, rather than a function call.
result: https://github.com/NullVoxPopuli/repro-for-emberjs-19790
😕 Actual Behavior
Living in the dark ages
🤔 Expected Behavior
Utilize support for native properties, private properties, methods, etc.
🌍 Environment
- Ember: - CLI 3.28.0
- Node.js/npm: -14.17.6
- OS: - n/a
- Browser: - n/a
➕ Additional Context
See the comparison between these two files:
Input: https://github.com/NullVoxPopuli/babel-transpilation-tests/blob/main/input.js
Output: https://github.com/NullVoxPopuli/babel-transpilation-tests/blob/main/output.js
This is correct.
But when I add that input file to ember, I get this for the output:
/home/nullvoxpopuli/Development/tmp/my-app/my-app/input.js: Class private methods are not enabled.
2 | #a = 'hi';
3 |
> 4 | get #b() {
| ^
5 | return 'hello' + this.#a;
6 | }
7 |
which... I guess is unrelated, but should still be fixed. Now, If I change the private methods/getters to public:
I get this mess:
var e, t, r
function n(e, t, r) {(function (e, t) {if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object")})(e, t), t.set(e, r)} function i(e, t) {
var r = function (e, t, r) {
if (!t.has(e)) throw new TypeError("attempted to " + r + " private field on non-instance")
return t.get(e)
}(e, t, "get")
return function (e, t) {
if (t.get) return t.get.call(e)
return t.value
}(e, r)
} r = new WeakMap, e = class {
constructor() {
var e, i, a, l
n(this, r, {writable: !0, value: "hi"}), e = this, i = "g", l = this, (a = t) && Object.defineProperty(e, i, {enumerable: a.enumerable, configurable: a.configurable, writable: a.writable, value: a.initializer ? a.initializer.call(l) : void 0})
} get b() {return "hello" + i(this, r)} get c() {return this.b}
}, a = e.prototype, l = "g", o = [f], u = {configurable: !0, enumerable: !0, writable: !0, initializer: null}, p = {}, Object.keys(u).forEach((function (e) {p[e] = u[e]})), p.enumerable = !!p.enumerable, p.configurable = !!p.configurable, ("value" in p || p.initializer) && (p.writable = !0), p = o.slice().reverse().reduce((function (e, t) {return t(a, l, e) || e}), p), d && void 0 !== p.initializer && (p.value = p.initializer ? p.initializer.call(d) : void 0, p.initializer = void 0), void 0 === p.initializer && (Object.defineProperty(a, l, p), p = null), t = p
var a, l, o, u, d, p
which is way wrong.
- Lenguaje dominante
- JavaScript
- Estrellas
- 151
- Forks
- 115
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de emberjs/ember-cli-babel
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
emberjs/ember-cli-babel#508 ·
-
Add support for Babel v8Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
emberjs/ember-cli-babel#535 · 1 comentario ·
-
Security: Vulnerable dependency [email protected] [SNYK-JS-MINIMATCH-15309438, CVE-2026-26996]Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
emberjs/ember-cli-babel#533 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
emberjs/ember-cli-babel#519 · 6 comentarios · 8 reacciones ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
emberjs/ember-cli-babel#517 ·
Todos los issues de emberjs/ember-cli-babel
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Yomguithereal/mnemonist#247 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
up-for-grabs/up-for-grabs.net#6330 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
TheOdinProject/curriculum#31490 ·
Los mantenedores suelen responder en 1 día
-
bug require-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
expressjs/expressjs.com#2549 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Docs: no path for someone who just wants to try IndiekitPosiblemente ocupada @rmdes la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
getindiekit/indiekit#1028 ·
Los mantenedores suelen responder en 1 día