@lark-apaas/fullstack-rspack-preset 1.0.50-alpha.1 → 1.0.50-alpha.2

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/lib/preset.js CHANGED
@@ -29,8 +29,6 @@ function sendBackendUnavailable502(_err, _req, res) {
29
29
  });
30
30
  res.end(JSON.stringify({ error: 'Bad Gateway', message: 'Backend service is not running' }));
31
31
  }
32
- // 检查是否启用宽松 build 模式
33
- const isLooseMode = process.env.FORCE_FRAMEWORK_BUILD_LOOSE_MODE === 'true';
34
32
  function readAppFlags(rootDir) {
35
33
  try {
36
34
  return JSON.parse(fs_1.default.readFileSync(path_1.default.resolve(rootDir, 'package.json'), 'utf-8')).flags || {};
@@ -148,16 +146,16 @@ function createRecommendRspackConfig(options) {
148
146
  {
149
147
  test: /\.tsx?$/,
150
148
  use: [
151
- ...(isLooseMode ? [{
152
- loader: require.resolve('babel-loader'),
153
- options: {
154
- plugins: [
155
- [
156
- require.resolve('@lark-apaas/styled-jsx/babel'),
157
- ]
149
+ {
150
+ loader: require.resolve('babel-loader'),
151
+ options: {
152
+ plugins: [
153
+ [
154
+ require.resolve('@lark-apaas/styled-jsx/babel'),
158
155
  ]
159
- },
160
- }] : []),
156
+ ]
157
+ },
158
+ },
161
159
  {
162
160
  loader: 'builtin:swc-loader',
163
161
  options: {
@@ -179,8 +177,8 @@ function createRecommendRspackConfig(options) {
179
177
  experimental: {
180
178
  // 避免 wasm 出现到根目录,统一放到 node_modules/.cache 目录下
181
179
  cacheRoot: path_1.default.join(rootDir, './node_modules/.cache/swc'),
182
- // 支持 styled-jsx 语法
183
- plugins: [isLooseMode ? null : [require.resolve('@swc/plugin-styled-jsx'), {}]].filter(Boolean),
180
+ // styled-jsx 统一由 babel-loader 处理,不再使用 @swc/plugin-styled-jsx(SWC 插件存在编译卡死问题)
181
+ plugins: [],
184
182
  },
185
183
  },
186
184
  },
@@ -32,11 +32,7 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
- const core_1 = __importDefault(require("@rspack/core"));
40
36
  const fs = __importStar(require("fs"));
41
37
  const path = __importStar(require("path"));
42
38
  class SourceMapUploadPlugin {
@@ -51,7 +47,7 @@ class SourceMapUploadPlugin {
51
47
  console.log('SourceMapUploadPlugin: Starting sourcemap consolidation process...');
52
48
  const outputPath = compiler.options.output.path;
53
49
  if (!outputPath) {
54
- compilation.warnings.push(new core_1.default.WebpackError('SourceMapUploadPlugin: compiler.options.output.path is not defined. Skipping sourcemap consolidation.'));
50
+ console.warn('SourceMapUploadPlugin: compiler.options.output.path is not defined. Skipping sourcemap consolidation.');
55
51
  return;
56
52
  }
57
53
  const assets = compilation.getAssets();
@@ -63,12 +59,7 @@ class SourceMapUploadPlugin {
63
59
  const outputBaseDir = path.basename(outputPath); // e.g., 'client'
64
60
  const sourcemapTargetDir = path.join(this.options.outputDir, outputBaseDir); // e.g., 'dist/sourcemaps/client'
65
61
  for (const sourceMap of sourceMaps) {
66
- let assetName = sourceMap.name;
67
- // Align with Vite's output structure by adding 'assets' and removing 'chunks'
68
- if (assetName.startsWith('chunks/')) {
69
- assetName = assetName.substring('chunks/'.length);
70
- }
71
- assetName = path.join('assets', assetName);
62
+ const assetName = path.join('assets', path.basename(sourceMap.name));
72
63
  const destinationPath = path.join(sourcemapTargetDir, assetName);
73
64
  const originalPath = path.join(outputPath, sourceMap.name);
74
65
  try {
@@ -88,19 +79,12 @@ class SourceMapUploadPlugin {
88
79
  console.log(`SourceMapUploadPlugin: Deleted original sourcemap ${originalPath}`);
89
80
  }
90
81
  catch (deleteError) {
91
- const deleteErrorMessage = `SourceMapUploadPlugin: Failed to delete original sourcemap ${originalPath}.`;
92
- compilation.warnings.push(new core_1.default.WebpackError(`${deleteErrorMessage} Error: ${String(deleteError)}`));
82
+ console.warn(`SourceMapUploadPlugin: Failed to delete original sourcemap ${originalPath}.`, deleteError);
93
83
  }
94
84
  }
95
85
  catch (error) {
96
86
  const errorMessage = `SourceMapUploadPlugin: Failed to consolidate ${assetName}.`;
97
87
  console.error(errorMessage, error);
98
- if (error instanceof Error) {
99
- compilation.errors.push(new Error(`${errorMessage} Error: ${error.message}`));
100
- }
101
- else {
102
- compilation.errors.push(new Error(`${errorMessage} Error: ${String(error)}`));
103
- }
104
88
  }
105
89
  }
106
90
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-rspack-preset",
3
- "version": "1.0.50-alpha.1",
3
+ "version": "1.0.50-alpha.2",
4
4
  "files": [
5
5
  "lib",
6
6
  "patches",
@@ -31,7 +31,7 @@
31
31
  "@babel/parser": "^7.28.0",
32
32
  "@babel/traverse": "^7.28.0",
33
33
  "@babel/types": "^7.28.2",
34
- "@lark-apaas/devtool-kits": "1.2.17-alpha.53",
34
+ "@lark-apaas/devtool-kits": "^1.2.20",
35
35
  "@lark-apaas/miaoda-inspector-babel-plugin": "^1.0.2",
36
36
  "@lark-apaas/styled-jsx": "^1.0.1",
37
37
  "@rspack/plugin-react-refresh": "^1.5.1",