Find require and import dynamic-import files of JavaScript file by ast
- find imports by filename
- support dynamic import
- support files
js
jsx
ts
tsx
- find imports files and child by entry file, eg: webpack entry
Install package npm install qw-find-imports
import { findImports } from "qw-find-imports";
const strs2 = findImports(
"XXXXXXXX/index.js",
{
findChild: true,
log: false,
baseUrl: ["XXXXXXXX"]
}
);
console.log(JSON.stringify(strs2, null, 2));