1.2.0 • Published 7 years ago

sibling-loader v1.2.0

Weekly downloads
15
License
MIT
Repository
github
Last release
7 years ago

sibling-loader Build Status

Webpack loader to import a file and its siblings.

i.e. all files with the same extension are imported.

Installation

npm install --save-dev sibling-loader

Usage

For a directory structure like:

└── abc
    ├── foo.js
    ├── bar.js
    ├── baz.js
    ├── somethingElse.txt
    └── styles.css

...code similar to the following examples is generated.

sibling-loader!./abc/foo imports everything with a wildcard:

import * as _0 from "./abc/foo.js";
import * as _1 from "./abc/bar.js";
import * as _2 from "./abc/baz.js";
export default { "foo.js": _0, "bar.js": _1, "baz.js": _2 };

sibling-loader?import=default!./abc/foo imports only the default export:

import { default as _0 } from "./abc/foo.js";
import { default as _1 } from "./abc/bar.js";
import { default as _2 } from "./abc/baz.js";
export default { "foo.js": _0, "bar.js": _1, "baz.js": _2 };

sibling-loader?import=someExportedName!./abc/foo imports an arbitrary export:

import { someExportedName as _0 } from "./abc/foo.js";
import { someExportedName as _1 } from "./abc/bar.js";
import { someExportedName as _2 } from "./abc/baz.js";
export default { "foo.js": _0, "bar.js": _1, "baz.js": _2 };
1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

0.0.1

7 years ago