-
-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: source map plugin module should enable by default (#7545)
- Loading branch information
Showing
4 changed files
with
49 additions
and
1 deletion.
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
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/configCases/source-map/plugin-defaults/App.jsx
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 @@ | ||
export function App() { | ||
return <div id="test">Hello Rspack!</div>; | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/rspack-test-tools/tests/configCases/source-map/plugin-defaults/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,13 @@ | ||
require("./App"); | ||
|
||
it("`module` should be enabled by default", async () => { | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
|
||
const source = fs.readFileSync(__filename + ".map", "utf-8"); | ||
const app = fs.readFileSync(path.resolve(CONTEXT, "./App.jsx"), "utf-8"); | ||
const map = JSON.parse(source); | ||
const appSourceIndex = map.sources.indexOf("webpack:///./App.jsx") | ||
expect(appSourceIndex).toBeGreaterThanOrEqual(0); | ||
expect(map.sourcesContent[appSourceIndex]).toEqual(app); | ||
}); |
32 changes: 32 additions & 0 deletions
32
packages/rspack-test-tools/tests/configCases/source-map/plugin-defaults/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,32 @@ | ||
const rspack = require("@rspack/core"); | ||
/** @type {import("@rspack/core").Configuration} */ | ||
module.exports = { | ||
devtool: false, | ||
resolve: { | ||
extensions: ["...", ".ts", ".tsx", ".jsx"] | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.jsx$/, | ||
loader: "builtin:swc-loader", | ||
options: { | ||
jsc: { | ||
parser: { | ||
syntax: "ecmascript", | ||
jsx: true | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new rspack.DefinePlugin({ | ||
CONTEXT: JSON.stringify(__dirname) | ||
}), | ||
new rspack.SourceMapDevToolPlugin({ | ||
filename: '[file].map[query]', | ||
}), | ||
] | ||
}; |
af5a43f
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
af5a43f
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