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

Slow startup time due to iterating all files in ignored directory #12392

Open
mozeryansky opened this issue Nov 24, 2020 · 3 comments
Open

Slow startup time due to iterating all files in ignored directory #12392

mozeryansky opened this issue Nov 24, 2020 · 3 comments

Comments

@mozeryansky
Copy link

I find that the startup time of my app is a little slow. While running DEBUG="*" npm run dev I noticed that a majority of the time it was skipping ignored files:

...
babel:config:config-chain No config is applied to "/Users/michael/repos/MyApp/node_modules/@shopify/koa-shopify-auth/dist/src/auth/client/storage-access-helper.js" because it matches one of `ignore: ["node_modules"]` from "/Users/michael/repos/MyApp" +1ms
babel:config:config-chain No config is applied to "/Users/michael/repos/MyApp/node_modules/@shopify/koa-shopify-auth/dist/src/verify-request/index.js" because it matches one of `ignore: ["node_modules"]` from "/Users/michael/repos/MyApp" +1ms
babel:config:config-chain No config is applied to "/Users/michael/repos/MyApp/node_modules/@shopify/koa-shopify-auth/dist/src/verify-request/verify-request.js" because it matches one of `ignore: ["node_modules"]` from "/Users/michael/repos/MyApp" +0ms
babel:config:config-chain No config is applied to "/Users/michael/repos/MyApp/node_modules/koa-compose/index.js" because it matches one of `ignore: ["node_modules"]` from "/Users/michael/repos/MyApp" +15ms
babel:config:config-chain No config is applied to "/Users/michael/repos/MyApp/node_modules/any-promise/index.js" because it matches one of `ignore: ["node_modules"]` from "/Users/michael/repos/MyApp" +1ms
babel:config:config-chain No config is applied to "/Users/michael/repos/MyApp/node_modules/any-promise/register.js" because it matches one of `ignore: ["node_modules"]` from "/Users/michael/repos/MyApp" +0ms
babel:config:config-chain No config is applied to "/Users/michael/repos/MyApp/node_modules/any-promise/loader.js" because it matches one of `ignore: ["node_modules"]` from "/Users/michael/repos/MyApp" +1ms
...

I noticed that the ignore code ignores file by file matching. Can it instead ignore the folder without iterating every file in the directory?

Relative file:

const message = `No config is applied to "${

require('@babel/register')({
  presets: ['@babel/preset-env'],
  ignore: ['node_modules']
});
  System:
    OS: macOS 11.0.1
  Binaries:
    Node: 12.18.3 - /usr/local/bin/node
    npm: 6.14.8 - /usr/local/bin/npm
  npmPackages:
    @babel/core: ^7.12.7 => 7.12.7 
    @babel/plugin-transform-runtime: ^7.12.1 => 7.12.1 
    @babel/polyfill: ^7.12.1 => 7.12.1 
    @babel/preset-env: ^7.12.7 => 7.12.7 
    @babel/preset-stage-3: ^7.8.3 => 7.8.3 
    @babel/register: ^7.12.1 => 7.12.1 
  • Babel version(s): 7.12.7
  • Node/npm version: Node v12.18.3, npm 6.14.8
  • OS: macOS 11.0.1
  • How you are using Babel: register
@babel-bot
Copy link
Collaborator

Hey @mozeryansky! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

@mozeryansky
Copy link
Author

Also I see this parameter in the compilerHook could be set to ignore node_module:

piratesRevert = addHook(compileHook, { exts, ignoreNodeModules: false });

ignoreNodeModules: true gives me a slight speedup

@JLHwung
Copy link
Contributor

JLHwung commented Nov 24, 2020

Duplicate of #9383

@babel babel deleted a comment from RamboHunterJb Nov 26, 2020
@babel babel deleted a comment from RamboHunterJb Nov 26, 2020
@babel babel deleted a comment from RamboHunterJb Nov 27, 2020
@babel babel deleted a comment from RamboHunterJb Nov 27, 2020
@babel babel deleted a comment from RamboHunterJb Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants