Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/rspack_binding_values/src/compilation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ impl JsCompilation {
original_module.map(ModuleIdentifier::from),
)
.await;

let js_result = JsExecuteModuleResult {
cacheable: res.cacheable,
file_dependencies: res
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
it("should compile", (done) => {
done()
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import("../../../../dist").PitchLoaderDefinitionFunction} */
module.exports = async function () {
try {
const result = await this.importModule("./syntax-error.js");

// here should be unreachable
expect(result).toBe(Symbol('unreachable'));
} catch (e) {
expect(e).toBeDefined()
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import("@rspack/core").Configuration} */
module.exports = {
entry: "./index.js",
module: {
rules: [
{
test: /index\.js/,
loader: "./loader",
options: {}
}
]
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ERROR in ./index.js
× Module build failed:
╰─▶ × Final loader(<PROJECT_ROOT>/tests/diagnosticsCases/module-build-failed/loader-import-syntax-error/loader.js??ruleSet[1].rules[0].use[0]) didn't return a Buffer or String

ERROR in × Module parse failed:
╰─▶ × JavaScript parsing error: Unexpected eof
╭────
1 │ console.log(
╰────

help:
You may need an appropriate loader to handle this file type.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log(
1 change: 1 addition & 0 deletions packages/rspack/src/builtin-plugin/css-extract/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export const pitch: LoaderDefinition["pitch"] = function (request, _, data) {
const callback = this.async();
const filepath = this.resourcePath;
const parseMeta = this.__internal__parseMeta;
this.addDependency(filepath);

let { publicPath } = this._compilation!.outputOptions;

Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/src/loader-runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export async function runLoaders(
}

if (res.error) {
reject(new Error(err));
reject(new Error(res.error));
} else {
resolve(
compiler.__internal__getModuleExecutionResult(res.id)
Expand Down