Giter Site home page Giter Site logo

ctocto / webpack-watched-glob-entries-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from milanzor/webpack-watched-glob-entries-plugin

0.0 1.0 0.0 147 KB

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

License: MIT License

JavaScript 100.00%

webpack-watched-glob-entries-plugin's Introduction

travis-build david-dm-status license downloads-week

Webpack-watched-glob-entries-plugin

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

Install

Install through yarn or npm =>

yarn add -D webpack-watched-glob-entries-plugin

or

npm install --save-dev webpack-watched-glob-entries-plugin

Usage

// Get the plugin
const WebpackWatchedGlobEntries = require('webpack-watched-glob-entries-plugin');
 
// In your Webpack config:
{
    ... // At your entry definition
    
    entry: WebpackWatchedGlobEntries.getEntries(
      [ 
        // Your path(s) 
        path.resolve(__dirname, 'entry/**/*.js'),
        path.resolve(__dirname, 'more/entries/**/*.js')
      ],
      {
          // Optional glob options that are passed to glob.sync()
          ignore: '**/*.test.js'
      }
    )
    
    ... // At the plugin definition
    
    plugins: [
        new WebpackWatchedGlobEntries(),
    ],
    
    ...
}

Why?

I wanted to use Webpack for my projects but was missing a way to add new entries without touching the config.

Example

If you have the following source structure:

- entries
    - main.js
    - Some
        - stuff.js
    - Other
        - things.js 

The entries will look like:

{
    "main":         "/abs/path/to/main.js",
    "Some/stuff":   "/abs/path/to/Some/stuff.js",
    "Other/things": "/abs/path/to/Other/things.js"
}

Now add [name] in your output.filename and the entry file directory structure will be reflected in the output directory.

webpack-watched-glob-entries-plugin's People

Contributors

milanzor avatar milan-corpoflow avatar handtrix avatar ndelangen avatar zachwolf avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.