@rsbuild/webpack 0.3.3 → 0.3.5

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.
@@ -25,8 +25,8 @@ var import_createCompiler = require("./createCompiler");
25
25
  var import_initConfigs = require("./initConfigs");
26
26
  var import_shared = require("@rsbuild/shared");
27
27
  const build = async (initOptions, { mode = "production", watch, compiler: customCompiler } = {}) => {
28
- if (!process.env.NODE_ENV) {
29
- process.env.NODE_ENV = mode;
28
+ if (!(0, import_shared.getNodeEnv)()) {
29
+ (0, import_shared.setNodeEnv)(mode);
30
30
  }
31
31
  const { context } = initOptions;
32
32
  let compiler;
@@ -32,9 +32,9 @@ async function inspectConfig({
32
32
  inspectOptions = {}
33
33
  }) {
34
34
  if (inspectOptions.env) {
35
- process.env.NODE_ENV = inspectOptions.env;
36
- } else if (!process.env.NODE_ENV) {
37
- process.env.NODE_ENV = "development";
35
+ (0, import_shared.setNodeEnv)(inspectOptions.env);
36
+ } else if (!(0, import_shared.getNodeEnv)()) {
37
+ (0, import_shared.setNodeEnv)("development");
38
38
  }
39
39
  const webpackConfigs = bundlerConfigs || (await (0, import_initConfigs.initConfigs)({
40
40
  context,
@@ -68,7 +68,7 @@ async function getChainUtils(target) {
68
68
  const { default: webpack } = await Promise.resolve().then(() => __toESM(require("webpack")));
69
69
  const { getHTMLPlugin } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core/provider")));
70
70
  const HtmlPlugin = getHTMLPlugin();
71
- const nodeEnv = process.env.NODE_ENV;
71
+ const nodeEnv = (0, import_shared.getNodeEnv)();
72
72
  const nameMap = {
73
73
  web: "client",
74
74
  node: "server",
@@ -31,19 +31,18 @@ __export(resolve_exports, {
31
31
  pluginResolve: () => pluginResolve
32
32
  });
33
33
  module.exports = __toCommonJS(resolve_exports);
34
- var import_path = __toESM(require("path"));
35
34
  var import_shared = require("@rsbuild/shared");
36
35
  async function applyTsConfigPathsPlugin({
37
36
  chain,
38
37
  CHAIN_ID,
39
- cwd,
40
38
  mainFields,
41
- extensions
39
+ extensions,
40
+ configFile
42
41
  }) {
43
42
  const { TsconfigPathsPlugin } = await Promise.resolve().then(() => __toESM(require("tsconfig-paths-webpack-plugin")));
44
43
  chain.resolve.plugin(CHAIN_ID.RESOLVE_PLUGIN.TS_CONFIG_PATHS).use(TsconfigPathsPlugin, [
45
44
  {
46
- configFile: import_path.default.resolve(cwd, import_shared.TS_CONFIG_FILE),
45
+ configFile,
47
46
  extensions,
48
47
  // https://github.com/dividab/tsconfig-paths-webpack-plugin/pull/106
49
48
  mainFields
@@ -66,12 +65,11 @@ const pluginResolve = () => ({
66
65
  (0, import_shared.applyResolvePlugin)(api);
67
66
  api.modifyBundlerChain(async (chain, { CHAIN_ID, target }) => {
68
67
  const config = api.getNormalizedConfig();
69
- const isTsProject = Boolean(api.context.tsconfigPath);
70
- if (isTsProject && config.source.aliasStrategy === "prefer-tsconfig") {
68
+ if (api.context.tsconfigPath && config.source.aliasStrategy === "prefer-tsconfig") {
71
69
  await applyTsConfigPathsPlugin({
72
70
  chain,
73
71
  CHAIN_ID,
74
- cwd: api.context.rootPath,
72
+ configFile: api.context.tsconfigPath,
75
73
  mainFields: getMainFields(chain, target),
76
74
  extensions: chain.resolve.extensions.values()
77
75
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/webpack",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "homepage": "https://rsbuild.dev",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,18 +30,18 @@
30
30
  "fast-glob": "^3.3.1",
31
31
  "globby": "^11.1.0",
32
32
  "html-webpack-plugin": "npm:html-rspack-plugin@5.5.7",
33
- "mini-css-extract-plugin": "2.7.6",
33
+ "mini-css-extract-plugin": "2.7.7",
34
34
  "postcss": "^8.4.33",
35
- "terser-webpack-plugin": "5.3.9",
35
+ "terser-webpack-plugin": "5.3.10",
36
36
  "tsconfig-paths-webpack-plugin": "4.1.0",
37
37
  "webpack": "^5.89.0",
38
- "@rsbuild/core": "0.3.3",
39
- "@rsbuild/shared": "0.3.3"
38
+ "@rsbuild/core": "0.3.5",
39
+ "@rsbuild/shared": "0.3.5"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "16.x",
43
43
  "typescript": "^5.3.0",
44
- "@scripts/test-helper": "1.0.0"
44
+ "@scripts/test-helper": "0.3.5"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public",