UNPKG

@nx/gatsby

Version:

Gatsby Plugin for Nx

21 lines 898 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.onCreateBabelConfig = void 0; const devkit_1 = require("@nx/devkit"); const path = require("path"); function onCreateBabelConfig({ actions }, options) { const tsConfig = (0, devkit_1.readJsonFile)(path.join(devkit_1.workspaceRoot, 'tsconfig.base.json')); const tsConfigPaths = tsConfig.compilerOptions.paths; const paths = Object.entries(tsConfigPaths).reduce((result, [key, paths]) => { return Object.assign(Object.assign({}, result), { [key]: paths.map((p) => path.join(devkit_1.workspaceRoot, p)) }); }, {}); actions.setBabelPlugin({ name: require.resolve(`babel-plugin-module-resolver`), options: { root: ['./src'], alias: paths, }, }); } exports.onCreateBabelConfig = onCreateBabelConfig; //# sourceMappingURL=gatsby-node.js.map