@shuvi/service 1.0.63 → 2.0.0-dev.7

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.
@@ -1,5 +1,5 @@
1
1
  import { RemoveListenerCallback } from '@shuvi/utils/events';
2
- import { Compiler as WebapckCompiler } from '@shuvi/toolpack/lib/webpack';
2
+ import { Compiler as RspackCompiler } from '@shuvi/toolpack/lib/webpack';
3
3
  import { Server } from '../server';
4
4
  import { IPluginContext } from '../core';
5
5
  import { Target } from '../core/plugin';
@@ -24,7 +24,7 @@ export interface Bundler {
24
24
  onBuildDone(cb: FinishedCallback): RemoveListenerCallback;
25
25
  onTypeCheckingDone(cb: FinishedCallback): RemoveListenerCallback;
26
26
  applyDevMiddlewares(server: Server): void;
27
- getSubCompiler(name: string): WebapckCompiler | undefined;
27
+ getSubCompiler(name: string): RspackCompiler | undefined;
28
28
  resolveTargetConfig(): Promise<Target[]>;
29
29
  }
30
30
  export interface CompilerStats {
@@ -36,9 +36,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.getBundler = getBundler;
39
- const path_1 = __importDefault(require("path"));
40
39
  const events_1 = require("@shuvi/utils/events");
41
- const forkTsCheckerWebpackPlugin_1 = __importStar(require("@shuvi/toolpack/lib/utils/forkTsCheckerWebpackPlugin"));
40
+ const tsCheckerRspackPlugin_1 = __importStar(require("@shuvi/toolpack/lib/utils/tsCheckerRspackPlugin"));
42
41
  const formatWebpackMessages_1 = __importDefault(require("@shuvi/toolpack/lib/utils/formatWebpackMessages"));
43
42
  const logger_1 = __importDefault(require("@shuvi/utils/logger"));
44
43
  const util_1 = require("util");
@@ -56,7 +55,7 @@ const defaultBundleOptions = {
56
55
  ignoreTypeScriptErrors: false
57
56
  };
58
57
  const hasEntry = (chain) => chain.entryPoints.values().length > 0;
59
- class WebpackBundler {
58
+ class RspackBundler {
60
59
  constructor(options, cliContext) {
61
60
  this._targets = [];
62
61
  this._buildEvent = (0, events_1.createEvent)();
@@ -75,19 +74,23 @@ class WebpackBundler {
75
74
  if (this._inited) {
76
75
  return;
77
76
  }
78
- let dynamicDll;
79
- if (this._options.preBundle) {
80
- dynamicDll = new webpack_1.DynamicDll({
81
- cacheDir: path_1.default.join(this._cliContext.paths.cacheDir, 'dll'),
82
- rootDir: this._cliContext.paths.rootDir,
83
- exclude: [/react-refresh/],
84
- resolveWebpackModule(module) {
85
- return (0, webpack_1.resolveWebpackModule)(module);
86
- }
87
- });
88
- this._devMiddlewares.push(dynamicDll.middleware);
89
- }
90
- this._compiler = yield this._getWebpackCompiler(dynamicDll);
77
+ /**
78
+ * @unsupported DynamicDll is not supported in Rspack.
79
+ * TODO: Implement DLL support if/when Rspack supports it.
80
+ */
81
+ // let dynamicDll: DynamicDll | undefined;
82
+ // if (this._options.preBundle) {
83
+ // dynamicDll = new DynamicDll({
84
+ // cacheDir: path.join(this._cliContext.paths.cacheDir, 'dll'),
85
+ // rootDir: this._cliContext.paths.rootDir,
86
+ // exclude: [/react-refresh/],
87
+ // resolveWebpackModule(module) {
88
+ // return resolveRspackModule(module);
89
+ // }
90
+ // });
91
+ // this._devMiddlewares.push(dynamicDll.middleware);
92
+ // }
93
+ this._compiler = yield this._getRspackCompiler( /*dynamicDll*/);
91
94
  this._inited = true;
92
95
  });
93
96
  }
@@ -125,10 +128,21 @@ class WebpackBundler {
125
128
  });
126
129
  }
127
130
  });
128
- const webpackWatching = this._compiler.watch(this._compiler.compilers.map(childCompiler => childCompiler.options.watchOptions || {}), () => {
131
+ /**
132
+ * TODO
133
+ */
134
+ // const webpackWatching = this._compiler.watch(
135
+ // this._compiler.compilers.map(
136
+ // childCompiler => childCompiler.options.watchOptions || {}
137
+ // ),
138
+ // () => {
139
+ // // do nothing
140
+ // }
141
+ // );
142
+ const rspackWatching = this._compiler.watch(this._compiler.compilers[0].options.watchOptions || {}, () => {
129
143
  // do nothing
130
144
  });
131
- this._watching.set(webpackWatching);
145
+ this._watching.set(rspackWatching);
132
146
  return this._watching;
133
147
  }
134
148
  build() {
@@ -137,7 +151,7 @@ class WebpackBundler {
137
151
  if (this._options.ignoreTypeScriptErrors) {
138
152
  logger_1.default.info('Skipping validation of types');
139
153
  this._compiler.compilers.forEach(compiler => {
140
- forkTsCheckerWebpackPlugin_1.default.getCompilerHooks(compiler).issues.tap('afterTypeScriptCheck', (issues) => issues.filter(msg => msg.severity !== 'error'));
154
+ tsCheckerRspackPlugin_1.default.getCompilerHooks(compiler).issues.tap('afterTypeScriptCheck', (issues) => issues.filter(msg => msg.severity !== 'error'));
141
155
  });
142
156
  }
143
157
  return (0, runCompiler_1.runCompiler)(compiler);
@@ -151,21 +165,22 @@ class WebpackBundler {
151
165
  get targets() {
152
166
  return this._targets;
153
167
  }
154
- _getWebpackCompiler(dynamicDll) {
168
+ _getRspackCompiler( /*dynamicDll?: DynamicDll | null*/) {
155
169
  return __awaiter(this, void 0, void 0, function* () {
156
170
  if (!this._compiler) {
157
171
  this._targets = yield this._getTargets();
158
- if (dynamicDll) {
159
- this._compiler = (0, webpack_1.webpack)(this._targets.map(({ config }) => {
160
- if (config.target === 'node') {
161
- return config;
162
- }
163
- return dynamicDll.modifyWebpack(config);
164
- }));
165
- }
166
- else {
167
- this._compiler = (0, webpack_1.webpack)(this._targets.map(t => t.config));
168
- }
172
+ // if (dynamicDll) {
173
+ // this._compiler = rspack(
174
+ // this._targets.map(({ config }) => {
175
+ // if (config.target === 'node') {
176
+ // return config;
177
+ // }
178
+ // return dynamicDll.modifyWebpack(config);
179
+ // })
180
+ // );
181
+ // } else {
182
+ this._compiler = (0, webpack_1.rspack)(this._targets.map(t => t.config));
183
+ // }
169
184
  let isFirstSuccessfulCompile = true;
170
185
  this._compiler.hooks.done.tap('done', (stats) => __awaiter(this, void 0, void 0, function* () {
171
186
  const warnings = [];
@@ -173,6 +188,7 @@ class WebpackBundler {
173
188
  this._isCompiling = false;
174
189
  let timeMessage = '';
175
190
  if (this._startTime) {
191
+ // @ts-ignore exists ts error
176
192
  const time = performance.now() - this._startTime;
177
193
  this._startTime = 0;
178
194
  timeMessage =
@@ -235,15 +251,15 @@ class WebpackBundler {
235
251
  tsMessagesPromise = undefined;
236
252
  isInvalid = true;
237
253
  });
238
- const useTypeScript = !!((_a = compiler.options.plugins) === null || _a === void 0 ? void 0 : _a.find(plugin => plugin instanceof forkTsCheckerWebpackPlugin_1.default));
254
+ const useTypeScript = !!((_a = compiler.options.plugins) === null || _a === void 0 ? void 0 : _a.find(plugin => plugin instanceof tsCheckerRspackPlugin_1.default));
239
255
  if (options.typeChecking && useTypeScript) {
240
- const typescriptFormatter = (0, forkTsCheckerWebpackPlugin_1.createCodeFrameFormatter)({});
256
+ const typescriptFormatter = (0, tsCheckerRspackPlugin_1.createCodeFrameFormatter)({});
241
257
  compiler.hooks.beforeCompile.tap('beforeCompile', () => {
242
258
  tsMessagesPromise = new Promise(resolve => {
243
259
  tsMessagesResolver = msgs => resolve(msgs);
244
260
  });
245
261
  });
246
- forkTsCheckerWebpackPlugin_1.default.getCompilerHooks(compiler).issues.tap('afterTypeScriptCheck', (issues) => {
262
+ tsCheckerRspackPlugin_1.default.getCompilerHooks(compiler).issues.tap('afterTypeScriptCheck', (issues) => {
247
263
  const format = (message) => {
248
264
  const file = (message.file || '').replace(/\\/g, '/');
249
265
  const formatted = typescriptFormatter(message);
@@ -263,10 +279,11 @@ class WebpackBundler {
263
279
  }
264
280
  compiler.hooks.invalid.tap('invalid', () => {
265
281
  if (this._startTime === null) {
282
+ // @ts-ignore exists ts error
266
283
  this._startTime = performance.now();
267
284
  }
268
285
  });
269
- // "done" event fires when Webpack has finished recompiling the bundle.
286
+ // "done" event fires when Rspack has finished recompiling the bundle.
270
287
  // Whether or not you have warnings or errors, you will get this event.
271
288
  compiler.hooks.done.tap('done', (stats) => __awaiter(this, void 0, void 0, function* () {
272
289
  var _a, _b;
@@ -276,7 +293,7 @@ class WebpackBundler {
276
293
  return;
277
294
  }
278
295
  isInvalid = false;
279
- // We have switched off the default Webpack output in WebpackDevServer
296
+ // We have switched off the default Rspack output in DevServer
280
297
  // options so we are going to "massage" the warnings and errors and present
281
298
  // them in a readable focused way.
282
299
  // We only construct the warnings and errors for speed:
@@ -359,23 +376,27 @@ class WebpackBundler {
359
376
  const extraTargets = (yield this._cliContext.pluginRunner.addExtraTarget({
360
377
  createConfig: this._createConfig.bind(this),
361
378
  mode: this._cliContext.mode,
362
- webpack: webpack_1.webpack
379
+ webpack: webpack_1.rspack
363
380
  })).filter(Boolean);
364
381
  buildTargets.push(...extraTargets);
365
- const defaultWebpackHelpers = { addExternals: config_1.addExternals };
382
+ const defaultRspackHelpers = { addExternals: config_1.addExternals };
366
383
  for (const buildTarget of buildTargets) {
367
384
  let { chain, name } = buildTarget;
368
385
  // modify config by api hooks
369
386
  chain = yield this._cliContext.pluginRunner.configWebpack(chain, {
370
387
  name,
371
388
  mode: this._cliContext.mode,
372
- helpers: defaultWebpackHelpers,
373
- webpack: webpack_1.webpack,
389
+ helpers: defaultRspackHelpers,
390
+ /**
391
+ * @deprecated use rspack instead
392
+ */
393
+ webpack: webpack_1.rspack,
394
+ rspack: webpack_1.rspack,
374
395
  resolveWebpackModule(path) {
375
- return (0, webpack_1.resolveWebpackModule)(path);
396
+ return (0, webpack_1.resolveRspackModule)(path);
376
397
  }
377
398
  });
378
- (0, config_1.checkWebpackExternals)(chain);
399
+ (0, config_1.checkRspackExternals)(chain);
379
400
  if (hasEntry(chain)) {
380
401
  const chainConfig = chain.toConfig();
381
402
  logger_1.default.debug(`${name} Config`);
@@ -397,7 +418,7 @@ function getBundler(ctx) {
397
418
  if (ctx.mode !== 'development') {
398
419
  options.preBundle = false;
399
420
  }
400
- const bundler = new WebpackBundler(options, ctx);
421
+ const bundler = new RspackBundler(options, ctx);
401
422
  yield bundler.init();
402
423
  return bundler;
403
424
  }
@@ -1,4 +1,4 @@
1
- import { WebpackChain } from '@shuvi/toolpack/lib/webpack/config';
1
+ import { RspackChain } from '@shuvi/toolpack/lib/webpack/config';
2
2
  import { IPluginContext } from '../core';
3
3
  export interface IWebpackEntry {
4
4
  [x: string]: string | string[];
@@ -10,4 +10,4 @@ export interface IWebpackConfigOptions {
10
10
  include?: string[];
11
11
  outputDir?: string;
12
12
  }
13
- export declare function createWebpackConfig({ mode, assetPublicPath, paths, config }: IPluginContext, { ...opts }: IWebpackConfigOptions): WebpackChain;
13
+ export declare function createWebpackConfig({ mode, assetPublicPath, paths, config }: IPluginContext, { ...opts }: IWebpackConfigOptions): RspackChain;
@@ -38,7 +38,7 @@ function createWebpackConfig({ mode, assetPublicPath, paths, config }, _a) {
38
38
  const jsConfig = (0, typescript_1.getJavaScriptInfo)();
39
39
  const compiler = Object.assign(Object.assign({}, config.compiler), { modularizeImports: experimental.modularizeImports, swcPlugins: experimental.swcPlugins, experimentalDecorators: Boolean((_b = jsConfig === null || jsConfig === void 0 ? void 0 : jsConfig.compilerOptions) === null || _b === void 0 ? void 0 : _b.experimentalDecorators), emitDecoratorMetadata: Boolean((_c = jsConfig === null || jsConfig === void 0 ? void 0 : jsConfig.compilerOptions) === null || _c === void 0 ? void 0 : _c.emitDecoratorMetadata) });
40
40
  if (opts.node) {
41
- chain = (0, config_1.createNodeWebpackChain)({
41
+ chain = (0, config_1.createNodeRspackChain)({
42
42
  name,
43
43
  dev,
44
44
  projectRoot,
@@ -54,7 +54,7 @@ function createWebpackConfig({ mode, assetPublicPath, paths, config }, _a) {
54
54
  });
55
55
  }
56
56
  else {
57
- chain = (0, config_1.createBrowserWebpackChain)({
57
+ chain = (0, config_1.createBrowserRspackChain)({
58
58
  name,
59
59
  dev,
60
60
  projectRoot,
@@ -1,7 +1,7 @@
1
1
  import { Compiler, MultiCompiler } from '@shuvi/toolpack/lib/webpack';
2
- import type { webpack } from '@shuvi/toolpack/lib/webpack';
2
+ import * as Rspack from '@shuvi/toolpack/lib/webpack';
3
3
  export type BundlerResult = {
4
- errors: webpack.StatsError[];
5
- warnings: webpack.StatsError[];
4
+ errors: Rspack.StatsError[];
5
+ warnings: Rspack.StatsError[];
6
6
  };
7
7
  export declare function runCompiler(compiler: Compiler | MultiCompiler): Promise<BundlerResult>;
package/lib/core/api.js CHANGED
@@ -52,7 +52,11 @@ const plugin_1 = require("./plugin");
52
52
  const config_1 = require("./config");
53
53
  const paths_1 = require("./paths");
54
54
  const getPlugins_1 = require("./getPlugins");
55
- const webpack_watch_wait_for_file_builder_plugin_1 = __importDefault(require("../lib/webpack-watch-wait-for-file-builder-plugin"));
55
+ /**
56
+ * @unsupported Rspack does not support WebpackWatchWaitForFileBuilderPlugin directly.
57
+ * TODO: Implement equivalent Rspack plugin or use Rspack's built-in watching capabilities.
58
+ */
59
+ // import WebpackWatchWaitForFileBuilderPlugin from '../lib/webpack-watch-wait-for-file-builder-plugin';
56
60
  const config_2 = require("../config");
57
61
  const ServiceModes = ['development', 'production'];
58
62
  class Api {
@@ -139,24 +143,28 @@ class Api {
139
143
  return config;
140
144
  }
141
145
  });
142
- const webpackWaitPlugin = createPlugin({
143
- configWebpack: config => {
144
- if (this.mode === 'development') {
145
- config
146
- .plugin('webpack-watch-wait-for-file-builder-plugin')
147
- .use(webpack_watch_wait_for_file_builder_plugin_1.default, [
148
- {
149
- onBuildStart: this._projectBuilder.onBuildStart,
150
- onBuildEnd: this._projectBuilder.onBuildEnd,
151
- onInvalid: this._projectBuilder.onInvalid,
152
- isDependency: this._projectBuilder.isDependency
153
- }
154
- ]);
155
- }
156
- return config;
157
- }
158
- });
159
- usePlugin(addIncludeToSwcLoader, webpackWaitPlugin);
146
+ /**
147
+ * @unsupported Rspack does not support WebpackWatchWaitForFileBuilderPlugin directly.
148
+ * TODO: Implement equivalent Rspack plugin or use Rspack's built-in watching capabilities.
149
+ */
150
+ // const rspackWaitPlugin = createPlugin({
151
+ // configRspack: config => {
152
+ // if (this.mode === 'development') {
153
+ // config
154
+ // .plugin('rspack-watch-wait-for-file-builder-plugin')
155
+ // .use(RspackWatchWaitForFileBuilderPlugin, [
156
+ // {
157
+ // onBuildStart: this._projectBuilder.onBuildStart,
158
+ // onBuildEnd: this._projectBuilder.onBuildEnd,
159
+ // onInvalid: this._projectBuilder.onInvalid,
160
+ // isDependency: this._projectBuilder.isDependency
161
+ // }
162
+ // ]);
163
+ // }
164
+ // return config;
165
+ // }
166
+ // });
167
+ usePlugin(addIncludeToSwcLoader /*, rspackWaitPlugin*/);
160
168
  // 2. init user plugins
161
169
  const userPlugins = (0, getPlugins_1.getPlugins)(this._cwd, {
162
170
  presets: this._presets,
@@ -1,6 +1,6 @@
1
1
  import { IPluginInstance, IPluginHandlers } from '@shuvi/hook';
2
2
  import { FileOptionWithId } from '../project/index';
3
- import { ExtraTargetAssistant, ConfigWebpackAssistant, TargetChain, BundlerDoneExtra, BundlerTargetDoneExtra, RuntimeService, Resources, AddRuntimeFileUtils, WebpackChainType } from './pluginTypes';
3
+ import { ExtraTargetAssistant, ConfigWebpackAssistant, TargetChain, BundlerDoneExtra, BundlerTargetDoneExtra, RuntimeService, Resources, AddRuntimeFileUtils, RspackChainType } from './pluginTypes';
4
4
  import { ShuviConfig, IPluginContext, CustomCorePluginHooks } from './apiTypes';
5
5
  declare const builtinPluginHooks: {
6
6
  extendConfig: import("@shuvi/hook").SyncWaterfallHook<ShuviConfig, void>;
@@ -9,7 +9,7 @@ declare const builtinPluginHooks: {
9
9
  afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
10
10
  afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<BundlerDoneExtra, void, void>;
11
11
  afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<BundlerTargetDoneExtra, void, void>;
12
- configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<WebpackChainType, ConfigWebpackAssistant>;
12
+ configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<RspackChainType, ConfigWebpackAssistant>;
13
13
  addExtraTarget: import("@shuvi/hook").AsyncParallelHook<ExtraTargetAssistant, void, TargetChain>;
14
14
  addResource: import("@shuvi/hook").AsyncParallelHook<void, void, Resources | Resources[]>;
15
15
  addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, AddRuntimeFileUtils, FileOptionWithId<any, any> | FileOptionWithId<any, any>[]>;
@@ -1,19 +1,24 @@
1
1
  import { RequestListener } from 'http';
2
- import { WebpackChain } from '@shuvi/toolpack/lib/webpack';
3
- import { webpack, Configuration } from '@shuvi/toolpack/lib/webpack';
4
- import { IWebpackHelpers } from '@shuvi/toolpack/lib/webpack/types';
2
+ import { RspackChain } from '@shuvi/toolpack/lib/webpack';
3
+ import * as Rspack from '@shuvi/toolpack/lib/webpack';
4
+ import { rspack, Configuration } from '@shuvi/toolpack/lib/webpack';
5
+ import { IWebpackHelpers } from '@shuvi/toolpack/lib/webpack/types.rspack';
5
6
  import { defineFile, FileBuilder } from '../project/index';
6
7
  import { IWebpackConfigOptions } from '../bundler/config';
7
8
  import { IServiceMode } from './apiTypes';
8
9
  export type ExtraTargetAssistant = {
9
- createConfig(options: IWebpackConfigOptions): WebpackChain;
10
+ createConfig(options: IWebpackConfigOptions): RspackChain;
10
11
  mode: IServiceMode;
11
- webpack: typeof webpack;
12
+ webpack: typeof rspack;
12
13
  };
13
14
  export type ConfigWebpackAssistant = {
14
15
  name: string;
15
16
  mode: IServiceMode;
16
- webpack: typeof webpack;
17
+ /**
18
+ * @deprecated use rspack instead
19
+ */
20
+ webpack: typeof rspack;
21
+ rspack: typeof rspack;
17
22
  /**
18
23
  * require webpack interal module
19
24
  * eg. resolveWebpackModule('webpack/lib/dependencies/ConstDependency')
@@ -23,7 +28,7 @@ export type ConfigWebpackAssistant = {
23
28
  };
24
29
  export interface TargetChain {
25
30
  name: string;
26
- chain: WebpackChain;
31
+ chain: RspackChain;
27
32
  }
28
33
  export interface Target {
29
34
  name: string;
@@ -31,12 +36,12 @@ export interface Target {
31
36
  }
32
37
  export type BundlerDoneExtra = {
33
38
  first: boolean;
34
- stats: webpack.MultiStats;
39
+ stats: Rspack.MultiStats;
35
40
  };
36
41
  export type BundlerTargetDoneExtra = {
37
42
  first: boolean;
38
43
  name: string;
39
- stats: webpack.Stats;
44
+ stats: Rspack.Stats;
40
45
  };
41
46
  export type RuntimeService = {
42
47
  source: string;
@@ -48,7 +53,7 @@ export type AddRuntimeFileUtils = {
48
53
  defineFile: typeof defineFile;
49
54
  getContent: FileBuilder<any>['getContent'];
50
55
  };
51
- export interface WebpackChainType extends WebpackChain {
56
+ export interface RspackChainType extends RspackChain {
52
57
  }
53
58
  export type AfterBuildOptions = {
54
59
  requestHandler: RequestListener;
@@ -171,24 +171,39 @@ class ShuviDevServer extends shuviServer_1.ShuviServer {
171
171
  (0, env_1.loadDotenvConfig)({ rootDir, forceReloadEnv: true });
172
172
  }
173
173
  configs.forEach(({ config }) => {
174
- var _a, _b, _c;
174
+ var _a;
175
175
  if (tsconfigChange) {
176
- (_b = (_a = config.resolve) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.forEach((plugin) => {
177
- // look for the JsConfigPathsPlugin and update with the latest paths/baseUrl config
178
- if (plugin && plugin.jsConfigPlugin && parseJsConfig) {
179
- const { resolvedBaseUrl, compilerOptions } = parseJsConfig;
180
- if (compilerOptions.paths && resolvedBaseUrl) {
181
- Object.keys(plugin.paths).forEach(key => {
182
- delete plugin.paths[key];
183
- });
184
- plugin.paths = Object.assign({}, compilerOptions.paths);
185
- plugin.resolvedBaseUrl = resolvedBaseUrl;
186
- }
187
- }
188
- });
176
+ /**
177
+ * @unsupported Rspack does not support resolve.plugins array like webpack.
178
+ * TODO: Handle this after Rspack support is available.
179
+ * For now, we'll use Rspack's built-in tsConfig support instead.
180
+ */
181
+ // config.resolve?.plugins?.forEach((plugin: any) => {
182
+ // // look for the JsConfigPathsPlugin and update with the latest paths/baseUrl config
183
+ // if (plugin && plugin.jsConfigPlugin && parseJsConfig) {
184
+ // const { resolvedBaseUrl, compilerOptions } = parseJsConfig;
185
+ // if (compilerOptions.paths && resolvedBaseUrl) {
186
+ // Object.keys(plugin.paths).forEach(key => {
187
+ // delete plugin.paths[key];
188
+ // });
189
+ // plugin.paths = { ...compilerOptions.paths };
190
+ // plugin.resolvedBaseUrl = resolvedBaseUrl;
191
+ // }
192
+ // }
193
+ // });
194
+ // Use Rspack's built-in tsConfig support
195
+ if (parseJsConfig && config.resolve) {
196
+ /**
197
+ * @TODO
198
+ * @unsupported Rspack's tsConfig type is not fully compatible with ParsedJsConfig.
199
+ * TODO: Update when Rspack provides proper TypeScript configuration support.
200
+ */
201
+ // @ts-expect-error wrong!!
202
+ config.resolve.tsConfig = parseJsConfig;
203
+ }
189
204
  }
190
205
  if (envChange) {
191
- (_c = config.plugins) === null || _c === void 0 ? void 0 : _c.forEach((plugin) => {
206
+ (_a = config.plugins) === null || _a === void 0 ? void 0 : _a.forEach((plugin) => {
192
207
  // we look for the DefinePlugin definitions so we can
193
208
  // update them on the active compilers
194
209
  if (plugin &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shuvi/service",
3
- "version": "1.0.63",
3
+ "version": "2.0.0-dev.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/shuvijs/shuvi.git",
@@ -29,14 +29,14 @@
29
29
  "@babel/generator": "7.14.5",
30
30
  "@babel/parser": "7.14.7",
31
31
  "@babel/traverse": "7.14.7",
32
- "@shuvi/hook": "1.0.63",
33
- "@shuvi/router": "1.0.63",
34
- "@shuvi/runtime": "1.0.63",
35
- "@shuvi/shared": "1.0.63",
36
- "@shuvi/toolpack": "1.0.63",
37
- "@shuvi/utils": "1.0.63",
38
- "@shuvi/error-overlay": "1.0.63",
39
- "@shuvi/reporters": "1.0.63",
32
+ "@shuvi/hook": "2.0.0-dev.7",
33
+ "@shuvi/router": "2.0.0-dev.7",
34
+ "@shuvi/runtime": "2.0.0-dev.7",
35
+ "@shuvi/shared": "2.0.0-dev.7",
36
+ "@shuvi/toolpack": "2.0.0-dev.7",
37
+ "@shuvi/utils": "2.0.0-dev.7",
38
+ "@shuvi/error-overlay": "2.0.0-dev.7",
39
+ "@shuvi/reporters": "2.0.0-dev.7",
40
40
  "commander": "5.1.0",
41
41
  "comment-json": "4.2.2",
42
42
  "cross-spawn": "7.0.3",