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

Generate source map from esprima tokens #8

Merged
merged 2 commits into from
Mar 26, 2017

Conversation

yuya-takeyama
Copy link
Contributor

Currently it can't generate source map without input source map.
So it can show wrong stack traces.

I added generateSourceMapFromTokens and it generate source map from tokens using esprima.

How to test

With v1.1.0

$ git checkout https://github.com/yuya-takeyama/strict-loader-test
$ yarn
$ yarn start
...
/Users/yuya/src/github.com/yuya-takeyama/strict-loader-test/foo.js:9
    throw new Error('Fail');
^
Error: Fail
    at bar (/Users/yuya/src/github.com/yuya-takeyama/strict-loader-test/foo.js:9:1)
    at foo (/Users/yuya/src/github.com/yuya-takeyama/strict-loader-test/foo.js:4:1)
    at Object.<anonymous> (/Users/yuya/src/github.com/yuya-takeyama/strict-loader-test/index.js:7:1)
...
error Command failed with exit code 1.

With this patch

$ git checkout use-fork
$ yarn
$ yarn start
...
/Users/yuya/src/github.com/yuya-takeyama/strict-loader-test/foo.js:7
    throw new Error('Fail');
          ^
Error: Fail
    at bar (/Users/yuya/src/github.com/yuya-takeyama/strict-loader-test/foo.js:7:11)
    at foo (/Users/yuya/src/github.com/yuya-takeyama/strict-loader-test/foo.js:2:3)
    at Object.<anonymous> (/Users/yuya/src/github.com/yuya-takeyama/strict-loader-test/index.js:5:1)
...
error Command failed with exit code 1.

To generate source map even though input source map is not specified
@mistadikay mistadikay merged commit a0bc91a into mistadikay:master Mar 26, 2017
@yuya-takeyama yuya-takeyama deleted the generate-source-map branch March 26, 2017 11:20
@mistadikay
Copy link
Owner

@yuya-takeyama thanks for the PR! published as v1.2.0. I don't use this loader anymore, so let me know how it works for you.

@yuya-takeyama
Copy link
Contributor Author

Thank you @mistadikay, now I upgraded strict-loader and it worked as I expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants