-
Notifications
You must be signed in to change notification settings - Fork 8
Description
We tried running webdoc with the webdoc.conf.json from the main README, but we encountered the following error.
Babel couldn't parse file in @webdoc/parser (node_modules/cjs-module-lexer/lexer.js)
C:\...\nvm\v15.4.0\node_modules\@webdoc\cli\node_modules\@babel\parser\lib\index.js:748
const err = new SyntaxError(message);
^
SyntaxError: Unexpected token, expected ")" (292:25)
at _temp._raise (C:\...\nvm\v15.4.0\node_modules\@webdoc\cli\node_modules\@babel\parser\lib\index.js:748:17)
at _temp.raiseWithData
....
loc: Position { line: 292, column: 25 },
pos: 9107
}
The main issue here is that it's not obvious which file has the supposed syntax error. Note that our code is written in TypeScript. We just changed the default top-level "includePattern": ["src/**/*.js"], to "includePattern": ["libs/**/*.ts"],.
Apparently, the actual lexer from the first line node_modules/cjs-module-lexer/lexer.js is parsed wrongly with babel. The pointed line 292:25 is this:
if (ch !== 58/*:*/) break;It looks like the parses hicks up on the comment (* is the 25th column), and misinterprets it, but it seems weird that a stable parser such as babel would produce this error. Maybe it's an error without our code after all (since our code also doesn't actually work, see #83), but I can't figure it out.
So although I'm unsure why this happens, the simple fix/workaround is to ignore the node_modules folder (I'm unsure why was it even included in the documentation generation step?), using the config we found on the pixi repository:
I'm also not sure where can I find the full documentation for the config file.