JSPM

magic-import

1.0.3
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • 0
    • Score
      100M100P100Q28982F
    • License ISC

    Magically import node modules while worrying less about subdirectories

    Package Exports

    • magic-import

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (magic-import) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    magic-import

    Importing files in node.js sucks, because you have to edit every single require() call whenever you restructure your subdirectories.

    The following code is boring and lame:

    const importantModule = require("../importantModule");
    const moduleInDir = require("./path/to/dir/ModuleInDir");

    What if you could do something exciting and cool like:

    const {
        importantModule, 
        moduleInDir
    } = require("magic-import");

    Well, now you can!

    Installation

    npm install magic-import

    Notes

    NOTE: Due to the fact subdirectories are ignored when specifying modules, every module in your project MUST be named differently.