-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Inline require #3493
Inline require #3493
Conversation
213c928
to
d83b564
Compare
Can you please bring back build to gitignore? It's hard to even scroll through so many lines and see what's changed in the source :( |
@thymikee Added a commit removing all |
Thank you, it's much better now ❤️ |
I have the worst Internet here in Berlin at JSConf but this is super duper awesome One thought: can we somehow verify that we always apply this optimization? I would like us to codemod all of Jest to imports at some point and use the inline-imports transform then but we also need to make sure that once we do that, we aren't breaking this and slowing Jest down a lot. |
@SimenB mind sending me an email to [email protected] so I get your email address, I'd like to invite you to our #jest-core channel. You've been doing stellar work on this project and we appreciate it a lot. |
That's what I'm doing here; converting from Might want to convert to |
dbc69ad
to
4feb415
Compare
c870623
to
00f48ed
Compare
Ok, this is ready for review now. From @cpojer's tip, I've left 2 outstanding issues:
The first failing test seems to be because we do |
ce6fb30
to
898106c
Compare
This is rebased now. Same two failures, which is interesting...
|
packages/babel-preset-jest/index.js
Outdated
@@ -8,6 +8,7 @@ | |||
|
|||
module.exports = { | |||
plugins: [ | |||
// Cannot be `import` as this file is not transpiled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind changing "transpiled" to "compiled" here and everywhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
Did a
|
Ok, I don't wanna be silly but could you do one more split?
That way the major change you are making is reduced to a very small PR that can be reverted more easily. |
Done: #3780 |
Improving startup time, and avoiding unused modules in the tree
Somehow I couldn't push to your branch so I opened a new PR at #3786. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This is WIP. I can keep working on it if the maintainers are interested 😄
Use
babel-plugin-transform-inline-imports-commonjs
to inline all requires, making most modules lazy-loaded. This should improve runtime performance.This strategy was used som places in the code base already, this change ensures it happens for everything.
build
dir is included in git to view how the code has changed (see second commit). Will of course remove it before merge.Test plan
yarn jest
should pass.