-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(airlight-resolve): add
ResolverFactory
options
docs(airlight-resolve): add basic example
- Loading branch information
Showing
3 changed files
with
15 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import resolve from '../resolve.mjs'; | ||
|
||
console.log([process.cwd()], resolve(process.cwd())); |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
const { ResolverFactory } = require('oxc-resolver'); | ||
|
||
const factory = new ResolverFactory({}); | ||
const factory = new ResolverFactory({ | ||
preferAbsolute: true, | ||
fullySpecified: false, | ||
mainFields: ['main', 'module', 'browser'], | ||
extensions: ['.ts', '.js', '.d.ts', '.html', '.md', '.json'] | ||
}); | ||
module.exports = function customResolve(...args) { | ||
return factory.sync(args[0], args.length < 2 ? args[0] : args.join('/')).path; | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import { ResolverFactory } from 'oxc-resolver'; | ||
|
||
const factory = new ResolverFactory({}); | ||
const factory = new ResolverFactory({ | ||
preferAbsolute: true, | ||
fullySpecified: false, | ||
mainFields: ['main', 'module', 'browser'], | ||
extensions: ['.ts', '.js', '.d.ts', '.html', '.md', '.json'] | ||
}); | ||
export default function customResolve(...args) { | ||
return factory.sync(args[0], args.length < 2 ? args[0] : args.join('/')).path; | ||
} |