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

Views bundler could run out of order #1131

Open
lannonbr opened this issue Feb 1, 2022 · 0 comments
Open

Views bundler could run out of order #1131

lannonbr opened this issue Feb 1, 2022 · 0 comments
Assignees
Labels

Comments

@lannonbr
Copy link
Member

lannonbr commented Feb 1, 2022

Currently in roosevelt.js line 225 as seen below, we have code to run the client views bundler, preprocessing CSS, parsing through isomorphic controllers, and bundling JS

preprocessCss()

require('./lib/isomorphicControllersFinder')(app)

require('./lib/viewsBundler')(app)

function preprocessCss () {
  require('./lib/preprocessCss')(app, bundleJs)
}

function bundleJs () {
  require('./lib/jsBundler')(app, validateHTML)
}

The issue I found recently was due to preprocessCss.js and jsBundler.js being async with promises within them, there is a chance that the JS bundler could start running before the viewsBundler finishes. As a suggestion, I think we should move the views bundler code to the top of these few requires so it runs first (and since it is synchronous, it will block and not let anything run before it is done). As well we may want to look into refactoring preprocessCss and jsBundler to be more explicit that they are promises and add some await calls to make things more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants