Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
[babel-register] ignore packages directory when running from source (e…
Browse files Browse the repository at this point in the history
…lastic#26098)

When running the Kibana distributable packages are excluded from `babel-register` because they are installed in the node_modules directory. When running from source they are not ignored, which means that babel-register is doing more work than necessary because these files need to already be built. To fix this I've added an ignore rule that excludes all packages when we are running from source.
  • Loading branch information
Spencer committed Nov 23, 2018
1 parent f19323d commit 164fc62
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/setup_node_env/babel_register/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ if (global.__BUILT_WITH_BABEL__) {
// building their server code at require-time since version 4.2
// TODO: the plugin install process could transpile plugin server code...
ignore.push(resolve(__dirname, '../../../src'));
} else {
ignore.push(
// ignore any path in the packages, unless it is in the package's
// root `src` directory, in any test or __tests__ directory, or it
// ends with .test.js, .test.ts, or .test.tsx
/\/packages\/(eslint-|kbn-)[^\/]+\/(?!src\/.*|(.+\/)?(test|__tests__)\/.+|.+\.test\.(js|ts|tsx)$)(.+$)/
);
}

// modifies all future calls to require() to automatically
Expand Down

0 comments on commit 164fc62

Please sign in to comment.