anko / eslisp

un-opinionated S-expression syntax and macro system for JavaScript
ISC License
528 stars 31 forks source link

Why do source maps fail on Windows? #36

Closed ktodyruik closed 8 years ago

ktodyruik commented 8 years ago

Hi,

I did two simple tests with source maps. Since I am new to working with source maps, I did one test with coffeescript and one test with eslisp. The coffee script test worked right away. With eslisp, I can't seem to get it working at all in Chrome. Can somebody confirm that it is working? Has anyone else had difficulty?

Thanks, Kerry

anko commented 8 years ago

What exactly did you try?

This works for me:

  1. Create test directory and change to it mkdir /tmp/test ; cd /tmp/test
  2. Create test elisp file echo '((. console log) "hi")' > test.esl
  3. Compile with an embedded source map eslc --embed-source-map test.esl > test.js
  4. Create test HTML page that pulls in the JS echo '<script src="test.js"></script>' > index.html
  5. Start serving test directory from local web server python -m http.server
  6. Open http://localhost:8000 in Chromium.
  7. Open dev tools and refresh the page to trigger loading the source map.

    String logged to console is labelled as being from test.esl:1:

    shot

Easily pasteable steps 1–5 (last step assumes python --version 3.x.x):

mkdir /tmp/test ; cd /tmp/test
echo '((. console log) "hi")' > test.esl
eslc --embed-source-map test.esl > test.js
echo '<script src="test.js"></script>' > index.html
python -m http.server
ktodyruik commented 8 years ago

i was using --source-map-outfile on Windows. Still not sure why it was not working for me. I went through your helpful reply, using --embed-source-map instead, and it worked great. I also tried it on both Linux and Windows and it works fine. Thanks! Kerry

anko commented 8 years ago

Do you still remember the error you got on Windows?

I have a new theory about why this might have happened: some parts of code might assume the file path separator to be / (correct on Linux) rather than \ (correct on Windows).

anko commented 8 years ago

Closing due to inactivity. Comment or reopen if you encounter this again or find more data.