Skip to content

Find require and import dynamic-import files of JavaScript file by ast

License

Notifications You must be signed in to change notification settings

codingwesley/find-imports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

find-imports

Find require and import dynamic-import files of JavaScript file by ast

Feature

  1. find imports by filename
  2. support dynamic import
  3. support files js jsx ts tsx
  4. find imports files and child by entry file, eg: webpack entry

Usage

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));

About

Find require and import dynamic-import files of JavaScript file by ast

Resources

License

Stars

Watchers

Forks

Packages

No packages published