5

Plain vanilla typescript dev environment set up with parcel.

I don't have SourceMap in browser (Edge/Chrome):

DevTools failed to load SourceMap: Could not parse content for http://localhost:1234/index.7cacc1f4.js.map: Unexpected token < in JSON at position 0

parcel serve log after page load:

$ parcel serve ./src/index.html --log-level verbose
ℹ️ Server running at http://localhost:1234
✨ Built in 3.15s
@parcel/reporter-dev-server: Request: localhost:1234/
@parcel/reporter-dev-server: Request: localhost:1234/index.7cacc1f4.js
@parcel/reporter-dev-server: Request: localhost:1234/index.7cacc1f4.js.map
@parcel/reporter-dev-server: Request: localhost:1234/favicon-32x32.232ca4f5.png

SourceMap file is in dist:

$ ls dist
__                              favicon-32x32.232ca4f5.png      index.453c97a0.js.map
apple-touch-icon.8e36bc09.png   favicon-32x32.a91f4dac.png      index.7cacc1f4.js
apple-touch-icon.e80caf23.png   index.031565ba.js               index.7cacc1f4.js.map
favicon-16x16.bc10cd1f.png      index.031565ba.js.map           index.html
favicon-16x16.d41cdce3.png      index.453c97a0.js

It seem parcel serve is returning index page instead of SourceMaps:

$ curl -v localhost:1234/index.7cacc1f4.js.map 
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 1234 (#0)
> GET /index.7cacc1f4.js.map HTTP/1.1
> Host: localhost:1234
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET, HEAD, PUT, PATCH, POST, DELETE
< Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Content-Type
< Content-Length: 630
< Content-Disposition: inline; filename="index.html"
< Accept-Ranges: bytes
< Last-Modified: Sun, 21 Mar 2021 17:09:09 GMT
< Content-Type: text/html; charset=utf-8
< Date: Sun, 21 Mar 2021 17:13:40 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
< 
<!DOCTYPE html>

<html lang="en">
  [....]
</html>
* Connection #0 to host localhost left intact
* Closing connection 0

parcel log from curl above:

@parcel/reporter-dev-server: Request: localhost:1234/index.7cacc1f4.js.map

parcel version: 2.0.0-beta.2

It is also weird parcel serve is not returning 404 just redirects to index when page not found?

@parcel/reporter-dev-server: Request: localhost:1234/asfsdfs.x
@parcel/reporter-dev-server: Request: localhost:1234/index.7cacc1f4.js
@parcel/reporter-dev-server: Request: localhost:1234/index.7cacc1f4.js.map
@parcel/reporter-dev-server: Request: localhost:1234/favicon-32x32.232ca4f5.png
@parcel/reporter-dev-server: Request: localhost:1234/__/static/site.webmanifest
1
  • I have the same problem, I'll let you know if I find a solution Commented Apr 8, 2021 at 18:41

1 Answer 1

0

It's a bug in parcel 2, but already fixed in the current nightly build: https://github.com/parcel-bundler/parcel/issues/6078

Sign up to request clarification or add additional context in comments.

2 Comments

thanks @markus Is the other part of the issue the same? Ie. no 404 on page not found. I switched to webpack because of these issues
I didn't check that, but maybe that's intended because of SPAs with client side routing (including client side 404 handling). If you plan to do server side routing, you might want to run your own server in dev mode and don't rely on parcel / webpack dev server behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.