Skip to content

Commit

Permalink
chore(NA): correctly import fs
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic committed Oct 15, 2021
1 parent 783bdee commit 02be1a3
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@
* Side Public License, v 1.
*/

const Fs = require('path');
const Fs = require('fs');
const Path = require('path');

const { REPO_ROOT } = require('@kbn/dev-utils');

const babelRegisterPaths = [
Path.resolve(REPO_ROOT, 'test'),
Path.resolve(REPO_ROOT, 'x-pack/test'),
Path.resolve(REPO_ROOT, 'examples'),
Path.resolve(REPO_ROOT, 'x-pack/examples'),
// TODO: should should probably remove this link back to the source
Path.resolve(REPO_ROOT, 'x-pack/plugins/task_manager/server/config.ts'),
Path.resolve(REPO_ROOT, 'src/core/utils/default_app_categories.ts'),
].map((path) => Fs.realpathSync(path));

// modifies all future calls to require() to automatically
// compile the required source with babel
require('@babel/register')({
ignore: [/[\/\\](node_modules|target|dist)[\/\\]/],
only: babelRegisterPaths,
only: [
Path.resolve(REPO_ROOT, 'test'),
Path.resolve(REPO_ROOT, 'x-pack/test'),
Path.resolve(REPO_ROOT, 'examples'),
Path.resolve(REPO_ROOT, 'x-pack/examples'),
// TODO: should should probably remove this link back to the source
Path.resolve(REPO_ROOT, 'x-pack/plugins/task_manager/server/config.ts'),
Path.resolve(REPO_ROOT, 'src/core/utils/default_app_categories.ts'),
].map((path) => Fs.realpathSync(path)),
babelrc: false,
presets: [require.resolve('@kbn/babel-preset/node_preset')],
extensions: ['.js', '.ts', '.tsx'],
Expand Down

0 comments on commit 02be1a3

Please sign in to comment.