1
0
Fork 0
mirror of https://github.com/rubyjs/mini_racer synced 2023-03-27 23:21:28 -04:00
mini_racer/examples/source-map-support/index.jsx
Ian Ker-Seymer 723958f4da Add example of using source-map-support (#130)
* Add example of using source-map-support

* Address PR comments
2019-03-12 16:03:08 +11:00

20 lines
590 B
JavaScript

import { ErrorCausingComponent } from "./error-causing-component.jsx";
if (process.env.NODE_ENV === "production") {
require("source-map-support").install({
// We tell the source-map-support package to retrieve our source maps by
// calling the `readSourceMap` global function, which we attached to the
// miniracer context
retrieveSourceMap: filename => {
return {
url: filename,
map: readSourceMap(filename)
};
}
});
}
// We expose this function so we can call it later
export function renderComponent() {
ErrorCausingComponent();
}