From fe890577607395d975c908836c826040cf96e5e4 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 6 Jun 2024 19:02:52 +0800 Subject: [PATCH] types: fix cache definition --- types/index.d.ts | 4 +++- types/test/rspack-chain-tests.ts | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index cc74838..3d7932f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -82,7 +82,9 @@ declare class Config extends __Config.ChainedMap { experiments(value: RspackConfig['experiments']): this; amd(value: RspackConfig['amd']): this; bail(value: RspackConfig['bail']): this; - cache(value: RspackConfig['cache']): this; + // TODO: Rspack does not support cache yet + cache(value: any): this; + // cache(value: RspackConfig['cache']): this; dependencies(value: RspackConfig['dependencies']): this; ignoreWarnings(value: RspackConfig['ignoreWarnings']): this; loader(value: RspackConfig['loader']): this; diff --git a/types/test/rspack-chain-tests.ts b/types/test/rspack-chain-tests.ts index 272706e..12f7e35 100644 --- a/types/test/rspack-chain-tests.ts +++ b/types/test/rspack-chain-tests.ts @@ -1,14 +1,14 @@ /** * Notes: The order structure of the type check follows the order - * of this document: https://github.com/neutrinojs/webpack-chain#config + * of this document: https://github.com/neutrinojs/rspack-chain#config */ import { Resolver } from 'enhanced-resolve'; -import * as webpack from '@rspack/core'; +import * as rspack from '@rspack/core'; import Config = require('rspack-chain'); type ResolvePlugin = Exclude< - Exclude[number], + Exclude[number], '...' >; @@ -153,7 +153,7 @@ config .end() .rules.delete('compile') .end() - //** support https://webpack.js.org/configuration/module/#ruletype */ + //** support https://rspack.js.org/configuration/module/#ruletype */ .rule('mjs-compile') .test(/\.mjs$/) .type('javascript/auto') @@ -210,7 +210,7 @@ config .end() .preferAbsolute(false) .plugin('foo') - .use(webpack.DefinePlugin) + .use(rspack.DefinePlugin) .end() .end() // optimization @@ -233,13 +233,13 @@ config .set('chunks', 'all') .end() .minimizer('foo') - .use(webpack.DefinePlugin) + .use(rspack.DefinePlugin) .tap((config) => []) .end() .end() // plugins .plugin('foo') - .use(webpack.DefinePlugin, [ + .use(rspack.DefinePlugin, [ { 'process.env.NODE_ENV': '', }, @@ -247,7 +247,7 @@ config .end() .plugin('bar') - .use(webpack.DefinePlugin, [ + .use(rspack.DefinePlugin, [ { 'process.env.NODE_ENV': '', }, @@ -256,7 +256,7 @@ config .end() .plugin('baz') - .use(webpack.DefinePlugin, [ + .use(rspack.DefinePlugin, [ { 'process.env.NODE_ENV': '', }, @@ -269,7 +269,7 @@ config .end() .plugin('asObject') - .use({ apply: (compiler: webpack.Compiler) => {} }) + .use({ apply: (compiler: rspack.Compiler) => {} }) .end() .plugins.delete('foo')