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

Make source-map work in the browser #1

Closed
wants to merge 2 commits into from

Conversation

hildjj
Copy link

@hildjj hildjj commented Oct 17, 2021

To test:

rm -rf node_modules package-lock.json
npm install
npm run build
ls -l docs/vendor/peggy/peggy.min.js

Note that the size of peggy.min.js is ~110kB, NOT ~500kB.

Run a web server (I'll eventually add one to the project so this is easier), and visit development/test.html

What this patch does:

  • Only uses source-map-generator in production. This avoids pulling in the wasm and JSON dependencies from source-map, which don't tree shake out and are not needed by the generator.
  • Uses source-map 0.7 for testing
  • Fixes up as many of the warnings as I could figure out from source-map requiring node modules like url, path, and fs, which aren't actually used in the tests
  • Ensures that the source-map tests run in the browser by pointing SourceMapConsumer at its needed WASM file, served from GitHub. Ideally, we will bundle this as base64 into the test file, but that's a problem for another day.

@hildjj
Copy link
Author

hildjj commented Oct 17, 2021

It also updates all of the other dependencies, since the eslint world is a mess at the moment.

@Mingun
Copy link
Owner

Mingun commented Oct 18, 2021

Thanks! Actually, I did the same things but forgot to run deploy scripts (on Windows this is not so easy as run npm run build ... because cp command is not working there).

I prefer to make a one commit for one purpose, so I've split transition to source-map-generator from the dependencies update. All your work in the source-map branch now, so I close this PR.

@Mingun Mingun closed this Oct 18, 2021
@hildjj hildjj deleted the source-map-browser branch October 19, 2021 16:32
Mingun pushed a commit that referenced this pull request Feb 19, 2023
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