Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including import-glob-loader with all npm packages installed. Try it out:

var importGlobLoader = require("import-glob-loader")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

import-glob-loader v1.1.0

Globbing preloader for Webpack


Globbing preloader for Webpack

Expands globbing patterns for import statements. Currently only does vertical expansion, e.g.

@import "foo/**/*";

Expands into

@import "foo/1.scss";
@import "foo/bar/2.scss";
@import "foo/bar/3.scss";


npm install import-glob-loader --save-dev


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.

  module: {
    preloaders: [{
      test: /\.scss/,
      loader: 'import-glob-loader'

Alternatively you can use it as a chained loader



All options are passthrough to node-glob. import-glob comes with two additional options.

  • test = 'import' The test for globbing to be applied. Lines matching test will be expanded. (This is a word-boundary test, so import will match @import but not importScript, for example)
  • delimiter = '\n' The delimiter used to join expanded globs.
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free