-
-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: duplicate emit source map from child compiler (#7847)
- Loading branch information
Showing
6 changed files
with
52 additions
and
7 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
1 change: 1 addition & 0 deletions
1
...k-test-tools/tests/configCases/plugins/source-map-dev-tool-plugin-child-compiler/child.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 @@ | ||
export const foo = 1; |
4 changes: 4 additions & 0 deletions
4
...k-test-tools/tests/configCases/plugins/source-map-dev-tool-plugin-child-compiler/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,4 @@ | ||
it("should successfully compile and retrieve assets from the child compiler", function () { | ||
const child = require('./child'); | ||
expect(child.foo).toBe(1); | ||
}); |
36 changes: 36 additions & 0 deletions
36
...ools/tests/configCases/plugins/source-map-dev-tool-plugin-child-compiler/rspack.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,36 @@ | ||
const path = require("path"); | ||
const rspack = require("@rspack/core"); | ||
|
||
const CHILD_ID = "child"; | ||
const CHILD_FILENAME = "./child"; | ||
|
||
/** | ||
* @type {import("@rspack/core").Configuration} | ||
*/ | ||
module.exports = { | ||
devtool: "source-map", | ||
node: { | ||
__dirname: false, | ||
__filename: false | ||
}, | ||
externals: { | ||
CHILD_FILENAME: `commonjs ${CHILD_FILENAME}` | ||
}, | ||
output: { | ||
filename: "[name].js" | ||
}, | ||
plugins: [ | ||
new rspack.DefinePlugin({ | ||
CONTEXT: JSON.stringify(__dirname) | ||
}), | ||
compiler => { | ||
compiler.hooks.make.tapAsync('PLUGIN', (compilation, callback) => { | ||
const outputOptions = {}; | ||
const childCompiler = compilation.createChildCompiler(CHILD_ID, outputOptions); | ||
const SingleEntryPlugin = compiler.webpack.EntryPlugin; | ||
new SingleEntryPlugin(compiler.context, path.join(__dirname, CHILD_FILENAME), CHILD_ID).apply(childCompiler); | ||
childCompiler.runAsChild(err => callback(err)); | ||
}); | ||
} | ||
] | ||
}; |
5aa2f24
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
5aa2f24
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