-
Notifications
You must be signed in to change notification settings - Fork 487
Closed
Description
When using dynamic imports, I am seeing the following parse errors:
$ ./node_modules/.bin/documentation build src/index.js -f html -o docs 10:00
SyntaxError: Unexpected token, expected { (8:8)
at Parser.pp$5.raise (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp.unexpected (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:1761:8)
at Parser.pp.expect (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:1749:33)
at Parser.pp$1.parseImportSpecifiers (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:2898:8)
at Parser.parseImportSpecifiers (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:6310:13)
at Parser.pp$1.parseImport (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:2868:10)
at Parser.pp$1.parseStatement (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:1884:49)
at Parser.parseStatement (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:5910:22)
at Parser.pp$1.parseIfStatement (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:2059:26)
at Parser.pp$1.parseStatement (/Users/esturcke/projects/documentation-dynamic-import-bug/node_modules/babylon/lib/index.js:1846:19)
The source code for index.js
is:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import registerServiceWorker from './registerServiceWorker';
const root = document.getElementById('root');
if (root)
import("./App").then(({ default: App }) => ReactDOM.render(<App />, root));
registerServiceWorker();
I've created a repo with the code that is failing to parse.
Is there a workaround and is this something that could be supported?
- What version of documentation.js are you using?: 5.3.0
- How are you running documentation.js (on the CLI, Node.js API, Grunt, other?): CLI
Metadata
Metadata
Assignees
Labels
No labels