Skip to content

Commit

Permalink
chore: align devtool default value (#6904)
Browse files Browse the repository at this point in the history
* chore: align devtool default value

* chore: update snapshot
  • Loading branch information
SyMind authored Jun 25, 2024
1 parent 88c9d09 commit 089726b
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,34 +236,34 @@ chunk (runtime: e2) e2.js (e2) 51 bytes (javascript) 8.38 KiB (runtime) [entry]
`;
exports[`statsOutput statsOutput/optimization-runtime-chunk should print correct stats for 1`] = `
"Entrypoint e1 4.01 KiB = e1~runtime.js 3.68 KiB e1.js 338 bytes
Entrypoint e2 4.01 KiB = e2~runtime.js 3.68 KiB e2.js 338 bytes
"Entrypoint e1 4.07 KiB = e1~runtime.js 3.68 KiB e1.js 391 bytes
Entrypoint e2 4.07 KiB = e2~runtime.js 3.68 KiB e2.js 391 bytes
chunk (runtime: e1~runtime) e1.js (e1) 27 bytes [entry] [rendered]
chunk (runtime: e1~runtime) e1~runtime.js (e1~runtime) 2.58 KiB [initial] [rendered]
chunk (runtime: e2~runtime) e2.js (e2) 27 bytes [entry] [rendered]
chunk (runtime: e2~runtime) e2~runtime.js (e2~runtime) 2.58 KiB [initial] [rendered]"
`;
exports[`statsOutput statsOutput/optimization-runtime-chunk-multiple should print correct stats for 1`] = `
"Entrypoint e1 4.01 KiB = runtime~e1.js 3.68 KiB e1.js 338 bytes
Entrypoint e2 4.01 KiB = runtime~e2.js 3.68 KiB e2.js 338 bytes
"Entrypoint e1 4.07 KiB = runtime~e1.js 3.68 KiB e1.js 391 bytes
Entrypoint e2 4.07 KiB = runtime~e2.js 3.68 KiB e2.js 391 bytes
chunk (runtime: runtime~e1) e1.js (e1) 27 bytes [entry] [rendered]
chunk (runtime: runtime~e2) e2.js (e2) 27 bytes [entry] [rendered]
chunk (runtime: runtime~e1) runtime~e1.js (runtime~e1) 2.58 KiB [initial] [rendered]
chunk (runtime: runtime~e2) runtime~e2.js (runtime~e2) 2.58 KiB [initial] [rendered]"
`;
exports[`statsOutput statsOutput/optimization-runtime-chunk-single should print correct stats for 1`] = `
"Entrypoint e1 4.01 KiB = runtime.js 3.68 KiB e1.js 338 bytes
Entrypoint e2 4.01 KiB = runtime.js 3.68 KiB e2.js 338 bytes
"Entrypoint e1 4.06 KiB = runtime.js 3.68 KiB e1.js 391 bytes
Entrypoint e2 4.06 KiB = runtime.js 3.68 KiB e2.js 391 bytes
chunk (runtime: runtime) e1.js (e1) 27 bytes [entry] [rendered]
chunk (runtime: runtime) e2.js (e2) 27 bytes [entry] [rendered]
chunk (runtime: runtime) runtime.js (runtime) 2.58 KiB [initial] [rendered]"
`;
exports[`statsOutput statsOutput/optimization-runtime-chunk-true should print correct stats for 1`] = `
"Entrypoint e1 4.01 KiB = runtime~e1.js 3.68 KiB e1.js 338 bytes
Entrypoint e2 4.01 KiB = runtime~e2.js 3.68 KiB e2.js 338 bytes
"Entrypoint e1 4.07 KiB = runtime~e1.js 3.68 KiB e1.js 391 bytes
Entrypoint e2 4.07 KiB = runtime~e2.js 3.68 KiB e2.js 391 bytes
chunk (runtime: runtime~e1) e1.js (e1) 27 bytes [entry] [rendered]
chunk (runtime: runtime~e2) e2.js (e2) 27 bytes [entry] [rendered]
chunk (runtime: runtime~e1) runtime~e1.js (runtime~e1) 2.58 KiB [initial] [rendered]
Expand Down Expand Up @@ -387,8 +387,8 @@ Rspack x.x.x compiled with 1 error in X s"
`;
exports[`statsOutput statsOutput/resolve-unexpected-exports-in-pkg-error should print correct stats for 1`] = `
"asset bundle.js 945 bytes [emitted] (name: main)
Entrypoint main 945 bytes = bundle.js
"asset bundle.js 1.38 KiB [emitted] (name: main)
Entrypoint main 1.38 KiB = bundle.js
runtime modules 280 bytes 1 module
./index.js 39 bytes [built] [code generated] [1 error]
Expand Down Expand Up @@ -441,8 +441,8 @@ Rspack x.x.x compiled successfully in X s"
`;
exports[`statsOutput statsOutput/simple-export should print correct stats for 1`] = `
"asset bundle.js 1.25 KiB [emitted] (name: main)
Entrypoint main 1.25 KiB = bundle.js
"asset bundle.js 1.71 KiB [emitted] (name: main)
Entrypoint main 1.71 KiB = bundle.js
runtime modules 677 bytes 3 modules
./index.js 26 bytes [built] [code generated]
Rspack x.x.x compiled successfully in X s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ module.exports = {
+ "type": "filesystem",
+ },
@@ ... @@
- "devtool": false,
+ "devtool": "eval",
@@ ... @@
- "mode": "none",
+ "mode": "development",
@@ ... @@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ module.exports = {
- "cache": false,
+ "cache": true,
@@ ... @@
- "devtool": false,
+ "devtool": "eval",
@@ ... @@
- "mode": "none",
+ "mode": "development",
@@ ... @@
Expand Down
3 changes: 1 addition & 2 deletions packages/rspack/src/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ export const applyRspackOptionsDefaults = (
}
}

// IGNORE(devtool): devtool is default to "eval" in webpack when mode is development
F(options, "devtool", () => false as const);
F(options, "devtool", () => (development ? "eval" : false));
D(options, "watch", false);
D(options, "profile", false);
// IGNORE(bail): bail is default to false in webpack, but it's set in `Compilation`
Expand Down
12 changes: 6 additions & 6 deletions webpack-test/__snapshots__/StatsTestCases.basictest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ Entrypoint main 294 KiB = no-warning.pro-node.js
./index.js 293 KiB [built] [code generated]
Rspack x.x.x compiled successfully in X s
asset no-warning.dev-web.js 294 KiB [emitted] (name: main)
Entrypoint main 294 KiB = no-warning.dev-web.js
asset no-warning.dev-web.js 1.72 MiB [emitted] (name: main)
Entrypoint main 1.72 MiB = no-warning.dev-web.js
./index.js 293 KiB [built] [code generated]
Rspack x.x.x compiled successfully in X s
asset no-warning.dev-node.js 294 KiB [emitted] (name: main)
Entrypoint main 294 KiB = no-warning.dev-node.js
asset no-warning.dev-node.js 1.72 MiB [emitted] (name: main)
Entrypoint main 1.72 MiB = no-warning.dev-node.js
./index.js 293 KiB [built] [code generated]
Rspack x.x.x compiled successfully in X s
asset no-warning.dev-web-with-limit-set.js 294 KiB [emitted] (name: main)
Entrypoint main 294 KiB = no-warning.dev-web-with-limit-set.js
asset no-warning.dev-web-with-limit-set.js 1.72 MiB [emitted] (name: main)
Entrypoint main 1.72 MiB = no-warning.dev-web-with-limit-set.js
./index.js 293 KiB [built] [code generated]
Rspack x.x.x compiled successfully in X s
Expand Down
2 changes: 1 addition & 1 deletion website/docs/en/config/devtool.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type Devtool =
| 'eval-nosources-source-map';
```

- **Default:** `false`
- **Default:** `eval`

The main types of Source Map generated behaviors are `source-map`, `eval`, `cheap`, `module`, `inline`, `nosources` and `hidden`, and can be combined.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/zh/config/devtool.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type Devtool =
| 'eval-nosources-source-map';
```

- **默认值:** `false`
- **默认值:** `eval`

主要分为 `source-map``eval``cheap``module``inline``nosources``hidden` 这几种 Source Map 生成的行为,并可以进行组合。

Expand Down

2 comments on commit 089726b

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
_selftest ✅ success
nx ✅ success
rspress ❌ failure
rsbuild ❌ failure
compat ✅ success
examples ❌ failure

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-06-25 7215fa8) Current Change
10000_development-mode + exec 2.19 s ± 29 ms 2.25 s ± 39 ms +2.82 %
10000_development-mode_hmr + exec 719 ms ± 9.5 ms 745 ms ± 6.8 ms +3.64 %
10000_production-mode + exec 2.71 s ± 29 ms 2.83 s ± 34 ms +4.30 %
arco-pro_development-mode + exec 1.91 s ± 66 ms 1.93 s ± 79 ms +0.97 %
arco-pro_development-mode_hmr + exec 437 ms ± 1.2 ms 442 ms ± 2.1 ms +0.99 %
arco-pro_production-mode + exec 3.44 s ± 80 ms 3.5 s ± 90 ms +1.81 %
threejs_development-mode_10x + exec 2 s ± 27 ms 1.63 s ± 11 ms -18.25 %
threejs_development-mode_10x_hmr + exec 815 ms ± 9.9 ms 838 ms ± 6.7 ms +2.78 %
threejs_production-mode_10x + exec 5.22 s ± 28 ms 4.94 s ± 28 ms -5.40 %

Please sign in to comment.