webpack-glob-entries-plugin

Provides a way to glob for entry files in Webpack watch and non-watch modes.

Usage no npm install needed!

<script type="module">
  import webpackGlobEntriesPlugin from 'https://cdn.skypack.dev/webpack-glob-entries-plugin';
</script>

README

webpack-glob-entries-plugin

Provides a way to glob for entry files in Webpack watch and non-watch modes.

NPM Version Download Status Node Version Dependencies

API

new WebpackGlobEntriesPlugin(globs: string|string[], options?: { glob: Object, resolveEntryName: Function });
  • globs: The glob string or array of glob strings.
  • options: The configure options.
    • options.glob: The node-glob configure options.
    • options.resolveEntryName: The entry name resolve function.

Usage

const WebpackGlobEntriesPlugin = require('webpack-glob-entries-plugin');

const watcher = new WebpackGlobEntriesPlugin('src/js/pages/**/*.js');

module.exports = {
  mode: 'development',
  entry: watcher.entries(),
  output: {
    publicPath: '/dist/',
    path: path.resolve('dist'),
    filename: 'js/pages/[name].js',
    chunkFilename: 'js/chunks/[chunkhash].js'
  },
  plugins: [watcher]
};

Thanks

Milanzor/webpack-watched-glob-entries-plugin