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

copy source map option from babel cli to babel node to enable source map support #13704

Closed
wants to merge 1 commit into from

Conversation

genx-tech
Copy link

@genx-tech genx-tech commented Aug 26, 2021

Fixes #1556, #7694

Source map of babel register is not working correctly for exception stack trace even if sourceMaps option is set to a non-false value in babel config. With the explicit --source-maps argument as advised at https://babeljs.io/docs/en/babel-cli#compile-with-source-maps, babel cli works perfectly. However, babel node does not accept a source map option to be passed to babel register. Copying the option from babel cli to babel node just fix this issue.

…map support

As observed and tested, babel register will not produce source map even if source map is configured in babel config. An explicit source map option is required to enable it. See https://babeljs.io/docs/en/babel-cli#compile-with-source-maps
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/48322/

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 69b61de:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@JLHwung
Copy link
Contributor

JLHwung commented Aug 26, 2021

Source map of babel register is not working correctly for exception stack trace even if sourceMaps option is set to a non-false value in babel config.

@babel/register does load babel config, if passing sourceMaps from programmatic options (as is in this PR) works but not for config file, this is certainly a bug in config resolving. I suspect your babel config is not loaded (e.g. .babelrc out side current project) Can you print the effective config? Or can you provide a reproduction repo?

Besides --sourceMap, there are other source map related command line options in @babel/cli, namely inputSourceMap, sourceFileName and sourceRoot. I don't think we generally want to port every command line option of @babel/cli to `@babel/node, since most Babel users will have a dedicated babel config and these options should be supported by babel config.

@liuxingbaoyu
Copy link
Member

fixed in #14950

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 23, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

babel-node sourcemap support
5 participants