Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source map is changed when re-running babel with no transforms. #10518

coreyfarrell opened this issue Oct 2, 2019 · 1 comment


Copy link

commented Oct 2, 2019

Bug Report

Current Behavior
Running no transform on babel output changes the source-map.

Input Code

'use strict';

const {transformSync} = require('@babel/core');

const source = `console.log('minimum test');`;
const baseConfig = {
  babelrc: false,
  configFile: false,
  filename: 'test.js',
  sourceMaps: true

const result1 = transformSync(source, baseConfig);
const result2 = transformSync(result1.code, Object.assign({inputSourceMap:}, baseConfig));

console.log(source === result1.code && source === result2.code ? 'Code is identical' : 'Code is changed');

Expected behavior/code should deeply equal


  • Babel version(s): 7.6.2
  • Node/npm version: node 12.11.0, npm 6.11.3
  • OS: Fedora 30
  • Monorepo: no
  • How you are using Babel: API

Additional context/Screenshots

  version: 3,
  sources: [ 'test.js' ],
  names: [ 'console', 'log' ],
  sourcesContent: [ "console.log('minimum test');" ]

  version: 3,
  sources: [ 'test.js' ],
  names: [ 'console' ],
  sourcesContent: [ "console.log('minimum test');" ]

This does seem to result in a loss of resolution in the source-map. See visualization of result1 compared to result2 - hovering over parts of the generated/original source will highlight what is associated from the other source.


This comment has been minimized.

Copy link

commented Oct 2, 2019

Hey @coreyfarrell! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.