https://github.com/tomashubelbauer/babel-sourcemap
Reproducing a Babel bug where string literals get mapped incorrectly when used as React children
https://github.com/tomashubelbauer/babel-sourcemap
babel babel-sourcemap sourcemap
Last synced: 7 months ago
JSON representation
Reproducing a Babel bug where string literals get mapped incorrectly when used as React children
- Host: GitHub
- URL: https://github.com/tomashubelbauer/babel-sourcemap
- Owner: TomasHubelbauer
- Created: 2019-12-16T08:48:51.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2022-12-31T00:51:09.000Z (about 3 years ago)
- Last Synced: 2025-06-01T16:42:44.951Z (9 months ago)
- Topics: babel, babel-sourcemap, sourcemap
- Language: JavaScript
- Homepage:
- Size: 74.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Babel Sourcemap Demo
This repository used to demonstrate a Babel string literal source mapping issue:
https://github.com/babel/babel/issues/10869.
The issue has been blocking https://github.com/TomasHubelbauer/cra-ast-localize
and has since been fixed so the repository has shifted to demonstrate a minimal
TypeScript transformer which visits all string literals and replaces their text
which is the purpose of the linked repository that was blocked by the issue.
## Running
First time setup:
```sh
cd demo
npm install
cd ..
npm install
```
Running the demo: `npm start`.
This will run Babel to transform the source code in `src` into the source code
in `lib` and then will run the demo script in `demo` which runs the TypeScript
tranformer.
The transformer changes the string literals in the files in `lib` so after the
`npm start` command has run, you can inspect them and see the additional `TEST`
markers surrounding the original strings that were added by the transformer.
## Updating dependencies
```
npm install @babel/cli @babel/core @babel/preset-env @babel/preset-react
cd demo
npm install source-map typescript
```