Skip to content
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

chunkExtractor.getScriptElements returns nested array in 5.13.1 #592

Closed
bendvc opened this issue Jul 7, 2020 · 7 comments · Fixed by #607
Closed

chunkExtractor.getScriptElements returns nested array in 5.13.1 #592

bendvc opened this issue Jul 7, 2020 · 7 comments · Fixed by #607
Assignees

Comments

@bendvc
Copy link

bendvc commented Jul 7, 2020

🐛 Bug Report

Public API for chunkExtractor.getScriptElements is described as being an Array of React <script> Elements. As of version 5.13.1 it returns an array who's first element is also an array.

To Reproduce

Unfortunately I cannot share my private repo. But the recent change to this function was the cause of this error.

getRequiredChunksScriptElement(extraProps) {

Previously it returned a single element, but is now returning an array that isn't getting spread in this function

getScriptElements(extraProps = {}) {

Expected behavior

chunkExtractor.getScriptElements returns an array of react script elements.

@open-collective-bot
Copy link

Hey @bendvc 👋,
Thank you for opening an issue. We'll get back to you as soon as we can.
Please, consider supporting us on Open Collective. We give a special attention to issues opened by backers.
If you use Loadable at work, you can also ask your company to sponsor us ❤️.

@theKashey theKashey self-assigned this Jul 8, 2020
@theKashey
Copy link
Collaborator

Yep, it could flatten scripts before returning.

@markwoodward23
Copy link
Contributor

@theKashey happy to pick this up if you're busy.

@theKashey
Copy link
Collaborator

@markwoodward23 - that would be very good. It's like a few lines to change, but I don't have any time to work on this.

@markwoodward23
Copy link
Contributor

markwoodward23 commented Jul 17, 2020

@theKashey - tried forking and install but I keep seeing this error when running tests:

FAIL  packages/server/src/ChunkExtractor.test.js
  ● Test suite failed to run

    Cannot find module '@loadable/component' from 'sharedInternals.js'

    However, Jest was able to find:
    	'./sharedInternals.js'

Any ideas?

@theKashey
Copy link
Collaborator

@markwoodward23 sounds like you need lerna bootstrap or yarn build made at the top level.

@markwoodward23
Copy link
Contributor

@bendvc / @theKashey #607

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

Successfully merging a pull request may close this issue.

3 participants