@modern-js/bff-core 2.7.1-alpha.4 → 2.7.1-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,25 +75,26 @@ const enableRegister = (requireFn) => {
75
75
  existTsLoader = Boolean(require.extensions[".ts"]);
76
76
  firstCall = false;
77
77
  }
78
- if (!existTsLoader && process.env.NODE_ENV === "development") {
79
- const projectSearchDir = import_path.default.dirname(modulePath);
80
- const tsNode = require("ts-node");
81
- tsNode.register({
82
- projectSearchDir,
83
- scope: true,
84
- transpileOnly: true,
85
- ignore: ["(?:^|/)node_modules/"]
86
- });
87
- const tsConfigPaths = require("tsconfig-paths");
88
- const loaderRes = tsConfigPaths.loadConfig(projectSearchDir);
89
- if (loaderRes.resultType === "success") {
90
- tsConfigPaths.register({
91
- baseUrl: loaderRes.absoluteBaseUrl,
92
- paths: loaderRes.paths
78
+ if (!existTsLoader) {
79
+ try {
80
+ const projectSearchDir = import_path.default.dirname(modulePath);
81
+ const tsNode = require("ts-node");
82
+ tsNode.register({
83
+ projectSearchDir,
84
+ scope: true,
85
+ transpileOnly: true,
86
+ ignore: ["(?:^|/)node_modules/"]
93
87
  });
88
+ const tsConfigPaths = require("tsconfig-paths");
89
+ const loaderRes = tsConfigPaths.loadConfig(projectSearchDir);
90
+ if (loaderRes.resultType === "success") {
91
+ tsConfigPaths.register({
92
+ baseUrl: loaderRes.absoluteBaseUrl,
93
+ paths: loaderRes.paths
94
+ });
95
+ }
96
+ } catch (e) {
94
97
  }
95
- const requiredModule2 = requireFn(modulePath);
96
- return requiredModule2;
97
98
  }
98
99
  const requiredModule = requireFn(modulePath);
99
100
  return requiredModule;
@@ -39,25 +39,26 @@ const enableRegister = (requireFn) => {
39
39
  existTsLoader = Boolean(require.extensions[".ts"]);
40
40
  firstCall = false;
41
41
  }
42
- if (!existTsLoader && process.env.NODE_ENV === "development") {
43
- const projectSearchDir = path.dirname(modulePath);
44
- const tsNode = require("ts-node");
45
- tsNode.register({
46
- projectSearchDir,
47
- scope: true,
48
- transpileOnly: true,
49
- ignore: ["(?:^|/)node_modules/"]
50
- });
51
- const tsConfigPaths = require("tsconfig-paths");
52
- const loaderRes = tsConfigPaths.loadConfig(projectSearchDir);
53
- if (loaderRes.resultType === "success") {
54
- tsConfigPaths.register({
55
- baseUrl: loaderRes.absoluteBaseUrl,
56
- paths: loaderRes.paths
42
+ if (!existTsLoader) {
43
+ try {
44
+ const projectSearchDir = path.dirname(modulePath);
45
+ const tsNode = require("ts-node");
46
+ tsNode.register({
47
+ projectSearchDir,
48
+ scope: true,
49
+ transpileOnly: true,
50
+ ignore: ["(?:^|/)node_modules/"]
57
51
  });
52
+ const tsConfigPaths = require("tsconfig-paths");
53
+ const loaderRes = tsConfigPaths.loadConfig(projectSearchDir);
54
+ if (loaderRes.resultType === "success") {
55
+ tsConfigPaths.register({
56
+ baseUrl: loaderRes.absoluteBaseUrl,
57
+ paths: loaderRes.paths
58
+ });
59
+ }
60
+ } catch (e) {
58
61
  }
59
- const requiredModule2 = requireFn(modulePath);
60
- return requiredModule2;
61
62
  }
62
63
  const requiredModule = requireFn(modulePath);
63
64
  return requiredModule;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.7.1-alpha.4",
14
+ "version": "2.7.1-alpha.6",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/cjs/index.js",