Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk committed Apr 24, 2024
1 parent 9a564ec commit dd4294f
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 62 deletions.
18 changes: 1 addition & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion crates/rspack_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ json = { workspace = true }
mime_guess = { workspace = true }
num-bigint = "0.4.4"
once_cell = { workspace = true }
oxc_resolver = { version = "1.6.7", features = ["package_json_raw_json_api"] }
oxc_resolver = { git = "https://github.com/oxc-project/oxc-resolver.git", branch = "main", features = [
"package_json_raw_json_api",
] }
paste = { workspace = true }
petgraph = { version = "0.6.4", features = ["serde-1"] }
rayon = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/rspack_core/src/resolver/resolver_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ fn to_oxc_resolver_options(
restrictions,
roots,
builtin_modules: false,
imports_fields: vec![vec!["imports".to_string()]],
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@ Object {
"modules": Array [
"node_modules",
],
"roots": Array [
"<cwd>",
],
},
"resolveLoader": Object {
"conditionNames": Array [
Expand Down
53 changes: 28 additions & 25 deletions packages/rspack-test-tools/tests/defaultsCases/cache/non-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,33 @@ module.exports = {
cwd: path.resolve(__dirname, "../../../../rspack/tests/fixtures"),
diff: e =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
- Expected
+ Received
@@ ... @@
- "cache": false,
- "context": "<cwd>",
+ "cache": Object {
+ "type": "filesystem",
+ },
+ "context": "<cwd>/tests/fixtures",
@@ ... @@
- "chunkLoadingGlobal": "webpackChunk_rspack_core",
+ "chunkLoadingGlobal": "webpackChunk",
@@ ... @@
- "devtoolNamespace": "@rspack/core",
+ "devtoolNamespace": "",
@@ ... @@
- "hotUpdateGlobal": "webpackHotUpdate_rspack_core",
+ "hotUpdateGlobal": "webpackHotUpdate",
@@ ... @@
- "path": "<cwd>/dist",
+ "path": "<cwd>/tests/fixtures/dist",
@@ ... @@
- "uniqueName": "@rspack/core",
+ "uniqueName": "",
`)
@@ ... @@
- "cache": false,
- "context": "<cwd>",
+ "cache": Object {
+ "type": "filesystem",
+ },
+ "context": "<cwd>/tests/fixtures",
@@ ... @@
- "chunkLoadingGlobal": "webpackChunk_rspack_core",
+ "chunkLoadingGlobal": "webpackChunk",
@@ ... @@
- "devtoolNamespace": "@rspack/core",
+ "devtoolNamespace": "",
@@ ... @@
- "hotUpdateGlobal": "webpackHotUpdate_rspack_core",
+ "hotUpdateGlobal": "webpackHotUpdate",
@@ ... @@
- "path": "<cwd>/dist",
+ "path": "<cwd>/tests/fixtures/dist",
@@ ... @@
- "uniqueName": "@rspack/core",
+ "uniqueName": "",
@@ ... @@
- "<cwd>",
+ "<cwd>/tests/fixtures",
`)
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,26 @@ module.exports = {
}),
diff: e =>
e.toMatchInlineSnapshot(`
- Expected
+ Received
- Expected
+ Received
@@ ... @@
- "context": "<cwd>",
+ "context": "<cwd>/tests/fixtures/browserslist",
@@ ... @@
- "chunkLoadingGlobal": "webpackChunk_rspack_core",
+ "chunkLoadingGlobal": "webpackChunkbrowserslist_test",
@@ ... @@
- "devtoolNamespace": "@rspack/core",
+ "devtoolNamespace": "browserslist-test",
@@ ... @@
- "hotUpdateGlobal": "webpackHotUpdate_rspack_core",
+ "hotUpdateGlobal": "webpackHotUpdatebrowserslist_test",
@@ ... @@
- "uniqueName": "@rspack/core",
+ "uniqueName": "browserslist-test",
`)
@@ ... @@
- "context": "<cwd>",
+ "context": "<cwd>/tests/fixtures/browserslist",
@@ ... @@
- "chunkLoadingGlobal": "webpackChunk_rspack_core",
+ "chunkLoadingGlobal": "webpackChunkbrowserslist_test",
@@ ... @@
- "devtoolNamespace": "@rspack/core",
+ "devtoolNamespace": "browserslist-test",
@@ ... @@
- "hotUpdateGlobal": "webpackHotUpdate_rspack_core",
+ "hotUpdateGlobal": "webpackHotUpdatebrowserslist_test",
@@ ... @@
- "uniqueName": "@rspack/core",
+ "uniqueName": "browserslist-test",
@@ ... @@
- "<cwd>",
+ "<cwd>/tests/fixtures/browserslist",
`)
};
2 changes: 1 addition & 1 deletion packages/rspack/src/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ const getResolveDefaults = ({
extensions: [],
aliasFields: [],
exportsFields: ["exports"],
roots: [context],
// roots: [context],
mainFields: ["main"],
byDependency: {
wasm: esmDeps(),
Expand Down

0 comments on commit dd4294f

Please sign in to comment.