@rsbuild/plugin-source-build 0.3.6 → 0.3.8

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.
package/dist/index.js CHANGED
@@ -35,8 +35,8 @@ __export(src_exports, {
35
35
  pluginSourceBuild: () => pluginSourceBuild
36
36
  });
37
37
  module.exports = __toCommonJS(src_exports);
38
- var import_fs = __toESM(require("fs"));
39
- var import_path = __toESM(require("path"));
38
+ var import_node_fs = __toESM(require("fs"));
39
+ var import_node_path = __toESM(require("path"));
40
40
  var import_shared = require("@rsbuild/shared");
41
41
  var import_core = require("@rsbuild/core");
42
42
  var import_monorepo_utils = require("@rsbuild/monorepo-utils");
@@ -91,10 +91,18 @@ function pluginSourceBuild(options) {
91
91
  }
92
92
  });
93
93
  });
94
- const getReferences = () => projects.map((project) => import_path.default.join(project.dir, import_shared.TS_CONFIG_FILE)).filter((filePath) => import_fs.default.existsSync(filePath));
94
+ const getReferences = () => projects.map((project) => import_node_path.default.join(project.dir, import_shared.TS_CONFIG_FILE)).filter((filePath) => import_node_fs.default.existsSync(filePath));
95
95
  if (api.context.bundlerType === "rspack") {
96
96
  api.modifyRspackConfig((config) => {
97
- (0, import_shared.setConfig)(config, "resolve.tsConfig.references", getReferences());
97
+ if (!api.context.tsconfigPath) {
98
+ return;
99
+ }
100
+ config.resolve || (config.resolve = {});
101
+ config.resolve.tsConfig = {
102
+ ...config.resolve.tsConfig,
103
+ configFile: api.context.tsconfigPath,
104
+ references: getReferences()
105
+ };
98
106
  });
99
107
  } else {
100
108
  api.modifyBundlerChain((chain, { CHAIN_ID }) => {
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import path from "path";
9
9
  // src/index.ts
10
10
  import fs from "fs";
11
11
  import path2 from "path";
12
- import { setConfig, TS_CONFIG_FILE } from "@rsbuild/shared";
12
+ import { TS_CONFIG_FILE } from "@rsbuild/shared";
13
13
  import { PLUGIN_BABEL_NAME } from "@rsbuild/core";
14
14
  import {
15
15
  filterByField,
@@ -69,7 +69,15 @@ function pluginSourceBuild(options) {
69
69
  const getReferences = () => projects.map((project) => path2.join(project.dir, TS_CONFIG_FILE)).filter((filePath) => fs.existsSync(filePath));
70
70
  if (api.context.bundlerType === "rspack") {
71
71
  api.modifyRspackConfig((config) => {
72
- setConfig(config, "resolve.tsConfig.references", getReferences());
72
+ if (!api.context.tsconfigPath) {
73
+ return;
74
+ }
75
+ config.resolve || (config.resolve = {});
76
+ config.resolve.tsConfig = {
77
+ ...config.resolve.tsConfig,
78
+ configFile: api.context.tsconfigPath,
79
+ references: getReferences()
80
+ };
73
81
  });
74
82
  } else {
75
83
  api.modifyBundlerChain((chain, { CHAIN_ID }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-source-build",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Source build plugin of Rsbuild",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -23,18 +23,18 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@rsbuild/monorepo-utils": "0.3.6",
27
- "@rsbuild/shared": "0.3.6"
26
+ "@rsbuild/monorepo-utils": "0.3.8",
27
+ "@rsbuild/shared": "0.3.8"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.23.2",
31
31
  "typescript": "^5.3.0",
32
- "@rsbuild/core": "0.3.6",
33
- "@rsbuild/plugin-babel": "0.3.6",
34
- "@scripts/test-helper": "0.3.6"
32
+ "@rsbuild/core": "0.3.8",
33
+ "@rsbuild/plugin-babel": "0.3.8",
34
+ "@scripts/test-helper": "0.3.8"
35
35
  },
36
36
  "peerDependencies": {
37
- "@rsbuild/core": "^0.3.6"
37
+ "@rsbuild/core": "^0.3.8"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public",