player-ui/tools

[@player-tools/cli] Add more info on compilation failures

Opened this issue · 0 comments

Feature request

It'd be beneficial to have the error stack logged on compilation errors here, so we can pinpoint where the syntax error occurred (given that it could be within an imported file).

Context

It could be challenging to determine where the error originated if you leverage barrels or flow import the .tsx files from elsewhere.

Example:

// index.ts
import { PLUGIN_ID } from "../constants";
import { navigation } from "./navigation";
import { schema } from "./schema";
import { views } from "./views";

const flow = {
  id: PLUGIN_ID,
  views,
  navigation,
  schema,
};

export default flow;

If there is an error on any of the views leveraged by the flow above, the error will point to the file being compiled:

Error compiling index.ts: Expected comma at character 26

Hopefully, the error stack trace can provide more info on which imported file is the culprit.