-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(minimizer): resolve error in minimizing esm asset file (#6521)
* fix: minimize js asset from a module package well * test: issue 6513 * style: fix clippy error
- Loading branch information
Showing
7 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/rspack-test-tools/tests/configCases/optimization/minimizer-esm-asset/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { fileURLToPath } from "node:url"; | ||
import { readFileSync } from "node:fs"; | ||
|
||
it("minimizing an asset file of esm type should success", () => { | ||
const worker = new URL("./pkg/pkg.js", import.meta.url); | ||
const minifiedContent = readFileSync(fileURLToPath(worker), "utf-8"); | ||
expect(minifiedContent).toMatchSnapshot(); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...ges/rspack-test-tools/tests/configCases/optimization/minimizer-esm-asset/pkg/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/optimization/minimizer-esm-asset/pkg/pkg.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
console.log(import.meta.url); | ||
|
||
export const a = 1; |
8 changes: 8 additions & 0 deletions
8
...es/rspack-test-tools/tests/configCases/optimization/minimizer-esm-asset/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @type {import("@rspack/core").Configuration} | ||
*/ | ||
module.exports = { | ||
optimization: { | ||
minimize: true | ||
} | ||
} |
06e98c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open
06e98c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open