ensure-script-loader

1.0.1 • Public • Published

ensure-script-loader

use glob to get script resources

Install

npm install --save-dev ensure-script-loader

Usage

var scripts = require("ensure-script-loader?pattern=./modules/**/*.js!");
scripts["./modules/first.js"]().then((first)=>{
    console.log(first);
});

notes

Although this is a'loader', it does not need to be passed in the source, so the parameters introduced in the'require' end with "!".

Options

name type default description
pattern string undefined Resource path
options object undefined glob options

pattern:Using glob pattern,it is the relative path to the value of context in webpack.

Package Sidebar

Install

npm i ensure-script-loader

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

2.44 kB

Total Files

3

Last publish

Collaborators

  • liyongleihf2006