import-glob-loader2
Globbing preloader for Webpack
Expands globbing patterns for import statements. Currently only does vertical expansion, e.g.
Expands into
Install
npm install import-glob-loader2 --save-dev
Usage
You can use it one of two ways, the recommended way is to use it as a preloader for files you know has import statements.
This usually applies to ES6 module import
statements, CSS @import
at-rules, and Sass @import
statements.
// Webpack 2: module: rules: test: /\.scss/ enforce: "pre" loader: "import-glob-loader" // ... // Webpack 1: module: preLoaders: test: /\.scss/ loader: 'import-glob-loader'
Alternatively you can use it as a chained loader
Options
All options are passthrough to node-glob. import-glob
comes with two additional options.
test = 'import'
The test for globbing to be applied. Lines matchingtest
will be expanded. (This is a word-boundary test, soimport
will match@import
but notimportScript
, for example)delimiter = '\n'
The delimiter used to join expanded globs.