Skip to content

Commit

Permalink
add build-babel.js to show missing sourcemaps
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunlebron committed Oct 11, 2022
1 parent c70cc91 commit c0d744e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions expo/build-babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// taken from: metro-babel-transformer
// https://github.com/facebook/metro/blob/main/packages/metro-babel-transformer/src/index.js

// TODO: see if a simpler source file results in source maps being correctly generated here

const { transformSync, parseSync, transformFromAstSync } = require("@babel/core");

const HermesParser = require("hermes-parser");

const { generateFunctionMap } = require("metro-source-map");

const fs = require('fs')


const FILENAME = "target/index.js"

const src = fs.readFileSync(FILENAME, 'utf8')

const babelConfig = {
ast: true,
code: false,
filename: FILENAME,
sourceType: "module",
inputSourceMap: true,
sourceMaps: true,
};

const sourceAst = parseSync(src, babelConfig);
const result = transformFromAstSync(sourceAst, src, babelConfig);

console.log(result)

0 comments on commit c0d744e

Please sign in to comment.