@rollup/plugin-babel causes SOURCEMAP_ERROR while reporting THIS_IS_UNDEFINED from unmapped generated helper code
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- babel, javascript
- Área
- build-system, tooling
Línea de trabajo
Start with the linked reproduction and run pnpm run build, comparing it with pnpm run build:bare. Trace how @rollup/plugin-babel 6.1.0 handles the sourcemap for src/index.js and generated helper code. Done means the plugin no longer adds SOURCEMAP_ERROR warnings while Rollup still reports THIS_IS_UNDEFINED.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Rollup Plugin Name
@rollup/plugin-babel
Plugin Version
6.1.0
Rollup Version
4.60.1
Operating System
Windows 11, but this does not appear to be Windows-specific.
Link to reproduction
https://github.com/shrinktofit/rollup-babel-sourcemap-bug
Expected Behavior
When Rollup reports THIS_IS_UNDEFINED for generated helper code that has no original source mapping, using @rollup/plugin-babel should not add extra SOURCEMAP_ERROR warnings.
Bare Rollup reports only THIS_IS_UNDEFINED for the same input.
Actual Behavior
With @rollup/plugin-babel in the pipeline, Rollup emits additional SOURCEMAP_ERROR warnings before the original THIS_IS_UNDEFINED warnings:
[onwarn] SOURCEMAP_ERROR src/index.js (1:17): Error when using sourcemap for reporting an error: Can't resolve original location of error.
[onwarn] THIS_IS_UNDEFINED src/index.js (1:17): The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
[onwarn] SOURCEMAP_ERROR src/index.js (1:25): Error when using sourcemap for reporting an error: Can't resolve original location of error.
[onwarn] THIS_IS_UNDEFINED src/index.js (1:25): The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
Steps to Reproduce
git clone https://github.com/shrinktofit/rollup-babel-sourcemap-bug.git
cd rollup-babel-sourcemap-bug
pnpm install
pnpm run build
For comparison, bare Rollup does not emit SOURCEMAP_ERROR:
pnpm run build:bare
Notes
The repro simulates TypeScript legacy decorator output:
var __decorate = (this && this.__decorate) || function () {};
export const value = 1;
//# sourceMappingURL=index.js.map
The sourcemap intentionally has no mapping for generated line 1, representing compiler-generated helper code. The mapping starts at generated line 2.
Bare Rollup reports THIS_IS_UNDEFINED without SOURCEMAP_ERROR. Once @rollup/plugin-babel is added, the input sourcemap enters the sourcemap chain and Rollup tries to map the generated helper location back to an original source location. Since helper code has no original mapping, that remapping fails and produces noisy SOURCEMAP_ERROR warnings.
This shape appears in real projects when bundling TypeScript output that contains inline legacy decorator helpers and sourcemaps.
- Lenguaje dominante
- JavaScript
- Estrellas
- 3.8k
- Forks
- 635
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
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 rollup/plugins
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Support js-yaml v5 Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Todos los issues de rollup/plugins
Issues similares
-
curation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
amponce/archive-movie-browser#186 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
clerk/javascript#9852 ·
-
bug p1 tools
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
HarperFast/skills#96 ·
-
factory-active factory-automatic task-bug-reproduction-cannot-reproduce task-identify-harness-labels-done task-identify-issue-type-done
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100