rollup-plugin-serve
rollup-plugin-serve copied to clipboard
Doesn't serve source maps correctly
My HTML (generated by the official HTML plugin):
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Rollup Bundle</title>
</head>
<body>
<script src="main.js" type="module"></script>
</body>
</html>
My main.js
:
const x = 1;
console.log(x + 2);
//# sourceMappingURL=main.js.map
The contents of the file main.js.map
, which sits right next to the main.js
file:
{"version":3,"file":"main.js","sources":["../src/main.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,MAAM,CAAC,GAAW,CAAC,CAAA;AACnB,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC"}
When I serve such a folder "normally" (e.g. using python3 -m http.server
, everything works correctly. The original main.ts
file is available through Chrome's developer tool.
But when I use this plugin to serve the folder, the source maps are inaccessible. Chrome somehow recognizes the directory structure, as you can see from the first image; however, the contents of this file are not getting fetched, as shown on the second image.
The error message reads the following.
Could not load content for http://localhost:10001/src/main.ts (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)