Skip to content

Lazy loading causes documentation crash. #1199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
koofka opened this issue Jan 4, 2019 · 1 comment
Closed

Lazy loading causes documentation crash. #1199

koofka opened this issue Jan 4, 2019 · 1 comment

Comments

@koofka
Copy link

koofka commented Jan 4, 2019

Working with a project with MapBox embedded that has been implemented via lazy loading in order to defer the file size impact. Using either smooth-code/loadable-components or React.lazy methods for importing the component causes a stack crash on documentation 9.1.1 that seems related to the dependency crawling. Removing the lazy loader allows the module to process normally.

Documentation is being run via the CLI:

documentation serve -c ./jsdoc.conf ./src/** --watch index.js

The two lazy loading methods attempted:

const MapBoxGL = loadable(() => import('components/molecules/MapBoxGL/index_ld.js'))

and

const MapBoxGL = React.lazy(() => import('components/molecules/MapBoxGL/index_ld.js'))

Both of which return the stack trace of:

Error: Parsing file /Users/{username}/Development/{client}/{project}/client/src/containers/MapBoxGLContainer.js: Unexpected token (25:9)
    at Deps.parseDeps (/usr/local/lib/node_modules/documentation/node_modules/module-deps-sortable/index.js:515:28)
    at fromSource (/usr/local/lib/node_modules/documentation/node_modules/module-deps-sortable/index.js:450:44)
    at /usr/local/lib/node_modules/documentation/node_modules/module-deps-sortable/index.js:444:17
    at ConcatStream.<anonymous> (/usr/local/lib/node_modules/documentation/node_modules/module-deps-sortable/node_modules/concat-stream/index.js:36:43)
    at ConcatStream.emit (events.js:187:15)
    at finishMaybe (/usr/local/lib/node_modules/documentation/node_modules/module-deps-sortable/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:475:14)
    at endWritable (/usr/local/lib/node_modules/documentation/node_modules/module-deps-sortable/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:485:3)
    at ConcatStream.Writable.end (/usr/local/lib/node_modules/documentation/node_modules/module-deps-sortable/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:455:41)
    at DuplexWrapper.onend (/usr/local/lib/node_modules/documentation/node_modules/readable-stream/lib/_stream_readable.js:577:10)
    at Object.onceWrapper (events.js:273:13)
documentation.js serving on port 4001
events.js:167
      throw er; // Unhandled 'error' event

Was planning to experiment this morning with a babel plugin that loadable-components offers added to the src/input/dependency.js file for documentation. But figured to offer this up if it was an unknown issue, as I couldn't find any existing reports in for the various packages involved.

@tmcw
Copy link
Member

tmcw commented Jan 4, 2019

Duplicate of #1149

@tmcw tmcw marked this as a duplicate of #1149 Jan 4, 2019
@tmcw tmcw closed this as completed Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants