Skip to content

Commit

Permalink
test: enable persistent cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Dec 30, 2024
1 parent b257e4b commit 68653dc
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 87 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
"pnpm": {
"overrides": {
"@rspack/core": "npm:@rspack-canary/[email protected]",
"@rspack/core": "1.2.0-alpha.0",
"zx>@types/node": "-"
}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ export async function createConstantRsbuildConfig(): Promise<EnvironmentConfig>
nodeEnv: false,
},
experiments: {
cache: {
type: 'persistent',
},
rspackFuture: {
bundlerInfo: {
force: false,
Expand Down
12 changes: 12 additions & 0 deletions packages/core/tests/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
"rspack": [
{
"experiments": {
"cache": {
"type": "persistent",
},
"rspackFuture": {
"bundlerInfo": {
"force": false,
Expand Down Expand Up @@ -378,6 +381,9 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
"rspack": [
{
"experiments": {
"cache": {
"type": "persistent",
},
"rspackFuture": {
"bundlerInfo": {
"force": false,
Expand Down Expand Up @@ -602,6 +608,9 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
"rspack": [
{
"experiments": {
"cache": {
"type": "persistent",
},
"rspackFuture": {
"bundlerInfo": {
"force": false,
Expand Down Expand Up @@ -773,6 +782,9 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
"rspack": [
{
"experiments": {
"cache": {
"type": "persistent",
},
"rspackFuture": {
"bundlerInfo": {
"force": false,
Expand Down
149 changes: 76 additions & 73 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions tests/integration/redirect/js.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ test('redirect.js default', async () => {

expect(indexContent).toMatchInlineSnapshot(`
"import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
import * as __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__ from "./bar/index.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
import * as __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__ from "./baz.js";
console.log('prettier: ', __WEBPACK_EXTERNAL_MODULE_prettier__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__.baz);
export { src_rslib_entry_ as default };
"
Expand All @@ -44,12 +46,14 @@ test('redirect.js.path false', async () => {

expect(indexContent).toMatchInlineSnapshot(`
"import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE__bar_js_fb2b582c__ from "@/bar.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_js_ce8863d2__ from "@/foo.js";
import * as __WEBPACK_EXTERNAL_MODULE__baz_js_b1797427__ from "~/baz.js";
import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
import * as __WEBPACK_EXTERNAL_MODULE__bar_943a8c75__ from "@/bar";
import * as __WEBPACK_EXTERNAL_MODULE__foo_a5f33889__ from "@/foo";
import * as __WEBPACK_EXTERNAL_MODULE__baz_3ce4598c__ from "~/baz";
import * as __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__ from "./bar.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__.bar + __WEBPACK_EXTERNAL_MODULE__foo_js_ce8863d2__.foo + __WEBPACK_EXTERNAL_MODULE__bar_js_fb2b582c__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_b1797427__.baz);
console.log('prettier: ', __WEBPACK_EXTERNAL_MODULE_prettier__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__.bar + __WEBPACK_EXTERNAL_MODULE__foo_a5f33889__.foo + __WEBPACK_EXTERNAL_MODULE__bar_943a8c75__.bar + __WEBPACK_EXTERNAL_MODULE__baz_3ce4598c__.baz);
export { src_rslib_entry_ as default };
"
`);
Expand All @@ -67,11 +71,13 @@ test('redirect.js.path with user override externals', async () => {

expect(indexContent).toMatchInlineSnapshot(`
"import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
import * as __WEBPACK_EXTERNAL_MODULE__others_bar_index_js_6776b573__ from "./others/bar/index.js";
import * as __WEBPACK_EXTERNAL_MODULE__others_foo_js_920f94ba__ from "./others/foo.js";
import * as __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__ from "./baz.js";
import * as __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__ from "./bar/index.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
console.log('prettier: ', __WEBPACK_EXTERNAL_MODULE_prettier__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__others_foo_js_920f94ba__.foo + __WEBPACK_EXTERNAL_MODULE__others_bar_index_js_6776b573__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__.baz);
export { src_rslib_entry_ as default };
"
Expand All @@ -98,11 +104,13 @@ test('redirect.js.path with user override alias', async () => {

expect(indexContent).toMatchInlineSnapshot(`
"import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
import * as __WEBPACK_EXTERNAL_MODULE__others_bar_index_js_6776b573__ from "./others/bar/index.js";
import * as __WEBPACK_EXTERNAL_MODULE__others_foo_js_920f94ba__ from "./others/foo.js";
import * as __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__ from "./baz.js";
import * as __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__ from "./bar/index.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
console.log('prettier: ', __WEBPACK_EXTERNAL_MODULE_prettier__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_js_89500c0c__.bar + __WEBPACK_EXTERNAL_MODULE__others_foo_js_920f94ba__.foo + __WEBPACK_EXTERNAL_MODULE__others_bar_index_js_6776b573__.bar + __WEBPACK_EXTERNAL_MODULE__baz_js_a2c1c788__.baz);
export { src_rslib_entry_ as default };
"
Expand All @@ -124,9 +132,11 @@ test('redirect.js.extension: false', async () => {
);
expect(indexContent).toMatchInlineSnapshot(`
"import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
import * as __WEBPACK_EXTERNAL_MODULE__bar_index_ts_bd8d18e6__ from "./bar/index.ts";
import * as __WEBPACK_EXTERNAL_MODULE__foo_ts_a526d0a1__ from "./foo.ts";
import * as __WEBPACK_EXTERNAL_MODULE__baz_ts_10ee073f__ from "./baz.ts";
console.log('prettier: ', __WEBPACK_EXTERNAL_MODULE_prettier__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_ts_a526d0a1__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_ts_bd8d18e6__.bar + __WEBPACK_EXTERNAL_MODULE__foo_ts_a526d0a1__.foo + __WEBPACK_EXTERNAL_MODULE__bar_index_ts_bd8d18e6__.bar + __WEBPACK_EXTERNAL_MODULE__baz_ts_10ee073f__.baz);
export { src_rslib_entry_ as default };
"
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/redirect/jsNotResolved.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ test('redirect.js default', async () => {
expect(indexContent).toMatchInlineSnapshot(`
"import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
import * as __WEBPACK_EXTERNAL_MODULE__bar_js__ from "./bar.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_js__ from "./foo.js";
import * as __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__ from "./bar.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
console.log('prettier: ', __WEBPACK_EXTERNAL_MODULE_prettier__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__["default"]);
export { src_rslib_entry_ as default };
"
`);
Expand All @@ -37,10 +37,10 @@ test('redirect.js.path false', async () => {
expect(indexContent).toMatchInlineSnapshot(`
"import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
import * as __WEBPACK_EXTERNAL_MODULE__bar_js__ from "./bar.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_js__ from "./foo.js";
import * as __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__ from "./bar.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__ from "./foo.js";
console.log('prettier: ', __WEBPACK_EXTERNAL_MODULE_prettier__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_js_fdf5aa2d__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__["default"]);
export { src_rslib_entry_ as default };
"
`);
Expand All @@ -59,10 +59,10 @@ test('redirect.js.extension: false', async () => {
expect(indexContent).toMatchInlineSnapshot(`
"import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
import * as __WEBPACK_EXTERNAL_MODULE__bar_js__ from "./bar.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo__ from "./foo";
import * as __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__ from "./bar.js";
import * as __WEBPACK_EXTERNAL_MODULE__foo_23da6eef__ from "./foo";
console.log('prettier: ', __WEBPACK_EXTERNAL_MODULE_prettier__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js__["default"]);
const src_rslib_entry_ = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].toUpper(__WEBPACK_EXTERNAL_MODULE__foo_23da6eef__["default"] + __WEBPACK_EXTERNAL_MODULE__bar_js_69b41beb__["default"]);
export { src_rslib_entry_ as default };
"
`);
Expand Down
9 changes: 9 additions & 0 deletions website/rspress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ export default defineConfig({
dev: {
lazyCompilation: true,
},
tools: {
rspack: {
experiments: {
cache: {
type: 'persistent',
},
},
},
},
source: {
alias: {
'@components': path.join(__dirname, '@components'),
Expand Down

0 comments on commit 68653dc

Please sign in to comment.