Giter Site home page Giter Site logo

grunt-webpack's Introduction

npm

Grunt Webpack

Use Webpack with Grunt.

Requirements

  • Version 6 of grunt-webpack supports webpack 5 and (optional) webpack-dev-server version 4.
    • For webpack 4 use version 5 of grunt-webpack
  • Node.js 16.13.0 or newer

Install

Install this grunt plugin next to your project's Gruntfile.js. You also need to install webpack yourself, this grunt plugin does not install webpack itself.

npm install webpack grunt-webpack --save-dev

If you also want to use the webpack-dev-server task you also need to install webpack-dev-server

npm install webpack-dev-server --save-dev

Then add this line to your project's Gruntfile.js gruntfile:

const webpackConfig = require('./webpack.config.js');

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    ...,
    webpack: {
      myConfig: webpackConfig,
    },
    ...
  });

  grunt.loadNpmTasks('grunt-webpack');
};

Configuration

webpack-grunt offers two different tasks webpack and webpack-dev-server. Both support all webpack options as can be seen in the webpack documentation. For exceptions and additions see this list.

Both Tasks

progress

Type: bool Default: true (false if no TTY present)

Activates or deactivates the progress output of webpack.

Webpack Task

failOnError

Type: bool Default: true (false if watch mode is used)

Will terminate the grunt process when an error happens if set to true. If set to false the grunt process will not be immediately terminated on error and instead continue to run.

keepalive

Type: bool Default: false (true if watch mode is used)

When set to true the grunt process/task will be kept alive after webpack task is finished. This is especially useful for watch as this usually needs to run as long as not manually killed.

storeStatsTo

Type: string Default: null

When set the stats from webpack will be written to a variable with the name provided in this option. The variable can later be used inside of other grunt tasks with template tags <%= %>.

...
storeStatsTo: "webpackStats"

...

<%= webpackStats.hash %>
...

For more information about grunt template tags have a look at the grunt docs.

watch

Type: bool Default: undefined

Turn on watch mode. This means that after the initial build, webpack will continue to watch for changes in any of the resolved files.

Turning on watch mode also sets the following defaults:

  • Default cache to true
  • Default keepalive to true
  • Default failOnError to false

Webpack-dev-server Task

There are no special options for this task. Some changed defaults for WebpackDevServer options are:

Name default value
devServer.host localhost

Examples

Webpack

imported config

This is a simple example that requires the webpack config from the config file. It also disables stats in non 'development' environments and enables watch in development.

const webpackConfig = require("./webpack.config.js");

module.exports = function (grunt) {
  grunt.initConfig({
    webpack: {
      options: {
        stats: !process.env.NODE_ENV || process.env.NODE_ENV === "development",
      },
      prod: webpackConfig,
      dev: Object.assign({ watch: true }, webpackConfig),
    },
  });

  grunt.loadNpmTasks("grunt-webpack");
};

The webpack task in this example has two targets called prod and dev. They can be renamed to everything besides options. See the grunt docs for more information about targets.

On the command line you can then do the following.

# Run webpack with the `prod` target
> NODE_ENV='production' grunt webpack:prod

# Run webpack with the `dev` target
> grunt webpack:dev

# Run webpack for all targets
> grunt webpack

For more examples and information have a look at the webpack documentation which mostly also applies here besides the noted differences above.

Lazy config loading

In some cases you might want to load the webpack config lazy. This can be done by specifying a function as the config value. The first paramter to this function will be the complete grunt config, which can be used in cases where grunt templates do not work (see below).

module.exports = function (grunt) {
  grunt.initConfig({
    webpack: {
      myconfig: () => ({
        entry: path.join(__dirname, "entry"),
        output: {
          path: __dirname,
          filename: "output.js",
        },
      }),
    },
  });

  grunt.loadNpmTasks("grunt-webpack");
};

You could also use a promise

const webpackConfig = require("./webpack.config.js");

module.exports = function (grunt) {
  grunt.initConfig({
    webpack: {
      myconfig: Promise.resolve(webpackConfig),
    },
  });

  grunt.loadNpmTasks("grunt-webpack");
};

Grunt templates

grunt-webpack supports grunt templates in all string values in it's configuration.

In the next example we use a template for output.filename.

module.exports = function (grunt) {
  grunt.initConfig({
    outputFileName: "output.js",
    webpack: {
      myconfig: {
        entry: path.join(__dirname, "entry"),
        output: {
          path: __dirname,
          filename: "<%= outputFileName %>",
        },
      },
    },
  });

  grunt.loadNpmTasks("grunt-webpack");
};

For plugins we cannot support grunt template interpolation, as plugins are class instances which we cannot modify during runtime without breaking them. If you need to use template in a string option to a plugin, you can use lazy config loading and use the supplied config. You can also use grunt inside directly to access utility methods:

module.exports = function (grunt) {
  grunt.initConfig({
    name: "Webpack",
    pkg: {
      copyright: "<%= name %>",
      version: "6.55.345",
    },
    webpack: {
      myconfig: (config) => ({
        entry: path.join(__dirname, "entry"),
        output: {
          path: __dirname,
          filename: "output.js",
        },
        plugins: [
          new webpack.BannerPlugin({
            banner: `/*! ${config.pkg.copyright} - Version ${
              config.pkg.version
            } dated ${grunt.template.today()} */`,
            raw: true,
          }),
        ],
      }),
    },
  });

  grunt.loadNpmTasks("grunt-webpack");
};

Webpack-dev-server

imported config

This is a simple example that requires the webpack config from the config file. Read how to configure webpack-dev-server in the webpack-dev-server documentation.

const webpackConfig = require("./webpack.config.js");

module.exports = function (grunt) {
  grunt.initConfig({
    "webpack-dev-server": {
      dev: webpackConfig,
    },
  });

  grunt.loadNpmTasks("grunt-webpack");
};

The webpack-dev-server task in this example has one target called dev. They can be renamed to everything besides options. See the grunt docs for more information about targets.

On the command line you can then do the following.

# Run webpack-dev-server with the `dev` target
> grunt webpack-dev-server:dev

# Run webpack for all possible targets
> grunt webpack-dev-server

For more examples and information have a look at the [webpack documentation]5] which mostly also applies here besides the noted differences above.

Troubleshooting

Circular reference detected (.plugins)

If you encounter this message it means that one of the plugins which are present in your config have circular references. This is not a bug in the plugin and is totally fine for webpack, but sadly grunt cannot handle these.

To workaround this problem use lazy config loading, by wrapping your config inside a function.

const webpackConfig = require("./webpack.config.js");

module.exports = function (grunt) {
  grunt.initConfig({
    webpack: {
      myconfig: () => webpackConfig,
    },
  });

  grunt.loadNpmTasks("grunt-webpack");
};

grunt-webpack's People

Contributors

alexander-akait avatar altano avatar amareshsm avatar bblackwo avatar chiplay avatar chollier avatar danez avatar daviferreira avatar dependabot[bot] avatar greenkeeper[bot] avatar jhnns avatar joaovieira avatar joshwiens avatar jshthornton avatar kurtharriger avatar linh1987 avatar ljqx avatar maksimr avatar mareksuscak avatar mischkl avatar muffinresearch avatar oliviertassinari avatar roddeh avatar samtiffin avatar sateffen avatar shama avatar snyamathi avatar sokra avatar stackfull avatar steinm91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grunt-webpack's Issues

Using watch-build cycle messes dependencies when cache is set to true

Using grunt I've tried to have a watch-build cycle (http://webpack.github.io/docs/usage-with-grunt.html) to simplify migration. It works well with cache: false in webpack.config but if I enable the caching it gets messy with dependencies.

For instance, I see those lines:

$ = require 'jquery' became $ = require(14);

but injection with id 14 is a jQuery plugin, not jQuery itself:

/***/ },
/* 14 */
/***/ function(module, exports, require) {

    /* WEBPACK VAR INJECTION */(function(require, jQuery) {/*
     * platformSelector: a jQuery plugin

webpack-dev-server: default host option to "localhost" instead of undefined

Forgive me if i'm missing something obvious, but would it make more sense to set host option of the webpack-dev-server task to be "localhost"?

I noticed all my socket.io connections for reloading were hitting http://undefined/... and couldn't work out why. Only when diving into task code did I see the problem.

It's not obvious that you should combine inline: true with the host option, so setting a better default for host like a good idea.

Add globbing support

It would be really nice to add globbing support for the entry or any files list so we can use the grunt replacements.

Support cascading options

Most grunt multitasks support cascading options. grunt-webpack doesn't seem to.

// This should work, but it does not
grunt.initConfig({
  webpack: {
    dev: {
      options: webpackDevOptions
    },
    prod: {
      options: webpackProdOptions
    }
  }
});

This is possibly due to this unusual pattern.

The general practice to get the options is through the this.options method, which allows you to merge defaults. Here's an example.

I'm willing to make up a PR to fix this @sokra, if it's something you're willing to support / if you think it's possible (to be honest I'm not too sure what getWithPlugins is doing).

Update...

Yup, you ignore the target options by going straight to grunt.config over here.

Update2...

This may be as simple as doing this:

var options = this.options(_.merge(
            {
                context: ".",
                output: {
                    path: "."
                },
                failOnError: true
            },
            getWithPlugins([this.name, "options"]),
            getWithPlugins([this.name, this.target]),
            function(a, b) {
                return grunt.util._.isArray(a) && grunt.util._.isArray(b) ? a.concat(b) : undefined;
            }
        ));

This seems to be working for me for now, but more testing is needed.

Config Example

Add a configuration example, a grunt file to demonstrate please.

    webpack: {
        file: {
            src: "./src/browser.js",
            dest: "./static/index.js"
        },
        data: {
            progress: true,
            verbose: true,
            colors: true
        }
    }

Finally understood what multiTask does, so I see this is wrong, but I don't know how I should pass options to webpack..

Using caching with jshint

Is there a way to configure grunt-webpack to use caching (i.e. watch + keep alive), but only when a previous task has executed successfully?

I only want the webpack task to run when the jshint task has completed successfully. But it should also use the caching which results in much faster webpack executions.

Cannot create multiple entry points

webpack: {
    build: {
        src: "./assets/scripts/tmp/Pages/*", //also tried entry here
        output: { // also tried dest here
            path: "./public/scripts",
        }
    }
}

I have page level js and wish to serve different files based on the current page. Also do not wish to add new file to here everytime i do a new page.

`--inline` option from Grunt

Why isn't there an inline config option equivalent to the --inline CLI param?

I want to achieve the same effect as launching webpack-dev-server --inline, but from a Grunt task. I would need to add the two entry points manually (['webpack-dev-server/client/index.js?http://localhost:8080', 'webpack/hot/dev-server'], but it feels to me that's Webpack internals, and I shouldn't put that stuff in my task.

@sokra what do you think?

module option must exist?

Code introduced in b6507da makes the assumption that options.module is required or always exists at this point. I did not see support for this in the webpack config doc.

Caught me off guard. Most of my configs define loaders, but I have some simple ones too. Maybe this is a reasonable assumption?

Anyways, just ran into this, so documenting it forward. Thanks for this tool!

Just saw #43. That is the same issue as this. Can close if fixed.

contentBase with an absolute path (http path) is being ignored

I believe this bug comes down to the tasks/webpack-dev-server.js file line 49. Perhaps before resolving the path, it could check if the contentBase is an http path or not.

E.g.

if (options.contentBase.indexOf('http') === -1)
{
    options.contentBase = path.resolve(process.cwd(), options.contentBase);
}

Cannot read property 'loaders' of undefined

Hi all:

My config works via cmd line, but not via grunt-webpack. Running grunt webpack renders:

Running tasks: webpack

Running "webpack" task

Running "webpack:main" (webpack) task
Verifying property webpack.main exists in config...OK
File: [no files]
Warning: Cannot read property 'loaders' of undefined Use --force to continue.

Tips?

works

webpack --progress --colors

does not work

grunt webpack with the following files

module.exports = function (grunt) {
    grunt.loadNpmTasks("grunt-webpack");
    grunt.initConfig({
        webpack: {
            options: require('./webpack.config.js'),
            build: require('./webpack.config.js')
        }
    });
};
var webpack = require('webpack');
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
var DedupePlugin = webpack.optimize.DedupePlugin;
var path = require('path');

module.exports = {
    entry: {
        tracker: './ampersand/app.js',
        main: './global-utils.js'
    },
    output: {
        path: path.join(__dirname + '/build', 'js'),
        filename: 'common.js'
    },
    plugins: [
        new DedupePlugin(),
        new CommonsChunkPlugin('global.js', ['tracker', 'main'])
    ]
};

Babel loader throws 'ERROR in fn.call is not a function' only when using grunt-webpack

Seems to work when the config is in it's own webpack.config.js, it's just when being used in grunt. My config for reference:

config.webpack = {
        dev: {
            entry: './app/app.js',
            output: {
                path: 'build/',
                filename: 'bundle.js'
            },

            resolve: {
                modulesDirectories: ['./node_modules', './app/vendors/bower']
            },

            module: {
                loaders: [
                    { test: /\.js$/, exclude: /node_modules|bower/, loaders: ['babel'] },
                ]
            },

            plugins: [
                new webpack.ResolverPlugin([
                    new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
                ])
            ],

            stats: {
                colors: true,
                modules: true,
                reasons: true
            }
        }
    };

The grunt output:

Registering "grunt-webpack" local Npm module tasks.
Reading /Users/roshanbhalla/dev/signal/UI/node_modules/grunt-webpack/package.json...OK
Parsing /Users/roshanbhalla/dev/signal/UI/node_modules/grunt-webpack/package.json...OK
Loading "webpack-dev-server.js" tasks...OK
+ webpack-dev-server
Loading "webpack.js" tasks...OK
+ webpack
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ build, build-webpack, dist, linting, server, server-dist, styleguide, test, validate

Running tasks: build-webpack

Running "build-webpack" task

Running "clean:build" (clean) task
Verifying property clean.build exists in config...OK
Files: build -> build
Options: force=false, no-write=false
Cleaning build...
>> 1 path cleaned.

Running "webpack:dev" (webpack) task
Verifying property webpack.dev exists in config...OK
File: [no files]
Hash: 396f0bfb9d565b6f60f0
Version: webpack 1.12.2
Time: 153ms
   [0] ./app/app.js 0 bytes [built] [failed]

ERROR in fn.call is not a function
Warning: Task "webpack:dev" failed. Use --force to continue.

Aborted due to warnings.

Conflict with browser-sync-webpack-plugin?

Hi, I'm trying to combine browser-sync-webpack-plugin and grunt-webpack, here's my configuration:

'webpack-dev-server': {
      dev: {
        webpack: _.extend({}, webpackConfig, {
          plugins: [
            new webpack.HotModuleReplacementPlugin(),
            new LiveReloadPlugin(),
            new BrowserSyncPlugin(
              // BrowserSync options
              {
                // browse to http://localhost:3000/ during development
                host: 'localhost',
                port: 3000,
                // proxy the Webpack Dev Server endpoint
                // (which should be serving on http://localhost:3100/)
                // through BrowserSync
                proxy: 'http://localhost:8080/'
              },
              // plugin options
              {
                // prevent BrowserSync from reloading the page
                // and let Webpack Dev Server take care of this
                reload: false
              }
            )
          ]
        }),
        watch: true,
        keepalive: true,
        //hot: true,
        //inline: true
      }
    }

and with grunt webpack-dev-server, it throws an error:

Running "webpack-dev-server:dev" (webpack-dev-server) task
Warning: Circular reference detected (.webpack.plugins[2].browserSync.instance.publicInstance) Use --force to continue.
Error: Circular reference detected (.webpack.plugins[2].browserSync.instance.publicInstance)
    at recurse (/Users/hongshu/dev/gitlab/v-tabs/node_modules/grunt/node_modules/grunt-legacy-util/index.js:99:15)
    at recurse (/Users/hongshu/dev/gitlab/v-tabs/node_modules/grunt/node_modules/grunt-legacy-util/index.js:119:20)
    at recurse (/Users/hongshu/dev/gitlab/v-tabs/node_modules/grunt/node_modules/grunt-legacy-util/index.js:119:20)
    at recurse (/Users/hongshu/dev/gitlab/v-tabs/node_modules/grunt/node_modules/grunt-legacy-util/index.js:119:20)
    at /Users/hongshu/dev/gitlab/v-tabs/node_modules/grunt/node_modules/grunt-legacy-util/index.js:110:16
    at Array.map (native)
    at recurse (/Users/hongshu/dev/gitlab/v-tabs/node_modules/grunt/node_modules/grunt-legacy-util/index.js:109:20)
    at recurse (/Users/hongshu/dev/gitlab/v-tabs/node_modules/grunt/node_modules/grunt-legacy-util/index.js:119:20)
    at recurse (/Users/hongshu/dev/gitlab/v-tabs/node_modules/grunt/node_modules/grunt-legacy-util/index.js:119:20)
    at Object.util.recurse (/Users/hongshu/dev/gitlab/v-tabs/node_modules/grunt/node_modules/grunt-legacy-util/index.js:130:10)

Aborted due to warnings.

Could you please provide any help? Thank you!

Segmentation Fault

After updating to the latest version of grunt-webpack, my builds stopped working. I started getting an error every time I tried to build:

Segmentation fault: 11

After resorting to ripping everything out of my Gruntfile.js, I was left with the following when it finally went away:

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json')/*,
    });

//  grunt.loadNpmTasks('grunt-webpack');
};

After commenting out grunt-webpack, I was finally able to complete my grunt build.

I'm running OSX 10.10.5. Other info:

$ node -v
v4.0.0
$ npm -v
2.14.2
$ grunt -V
grunt-cli v0.1.13
grunt v0.4.5
  "devDependencies": {
    "webpack": "1.12.2",
    "jsx-loader": "0.13.2",
    "style-loader": "0.12.4",
    "css-loader": "0.19.0",
    "json-loader": "0.5.3",
    "grunt": "0.4.5",
    "grunt-webpack": "1.0.11",
    "grunt-contrib-less": "0.11.3",
    "grunt-contrib-watch": "0.6.1"
  },

Output of Final Discovery Attempts:

$ grunt --force
Segmentation fault: 11
$ grunt --force
Warning: Task "default" not found. Used --force, continuing.

Done, but with warnings.

After discovering what the issue was, I decided to try verbose to see if I could find out where it was failing, and I got the following output:

$ grunt -v
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK

Registering "grunt-webpack" local Npm module tasks.
Reading /********/node_modules/grunt-webpack/package.json...OK
Parsing /********/node_modules/grunt-webpack/package.json...OK
Segmentation fault: 11

error while using `storeStatsTo`

hi.

Running "xyz" task
>> A special character was detected in this template. Inside template tags, the
>> \n and \r special characters must be escaped as \\n and \\r. (grunt 0.4.0+)

I think it's because stats object contains the original files sources as strings.

{
    ...
    storeStatsTo: 'xyz',
    ...
}
grunt.task.registerTask('xyz', 'foo', function() {
    fs.writeFileSync('stats.json', JSON.stringify(grunt.config.get('xyz')));
});

maybe impement something like storeStatsToFile option is a good idea?

Warning: Object.keys called on non-object Use --force to continue.

I don't know where this is comming from and need help to push it further.

I have this script:

var $ = require('jquery');
$(function () {
    alert("BLAAAAAAAAAAAAA")
})

And this Gruntfile.js:

module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-webpack');
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        webpack: {
            entry: "./src/main.js",
            output: {
                path: "static/",
                filename: "app.js",
            },
        },
    });
    grunt.registerTask('default', ['webpack']);
};

And this fails to build with this message:

$ grunt --verbose
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.

Registering "grunt-webpack" local Npm module tasks.
Reading /home/matias/Proyectos/ltmo/node_modules/grunt-webpack/package.json...OK
Parsing /home/matias/Proyectos/ltmo/node_modules/grunt-webpack/package.json...OK
Loading "webpack-dev-server.js" tasks...OK
+ webpack-dev-server
Loading "webpack.js" tasks...OK
+ webpack
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ default

No tasks specified, running default tasks.
Running tasks: default

Running "default" task

Running "webpack" task

Running "webpack:entry" (webpack) task
Verifying property webpack.entry exists in config...OK
Files: ./src/main.js -> entry
Warning: Object.keys called on non-object Use --force to continue.

Aborted due to warnings.

What am I doing wrong?

"someName" docs

What is "someName"? I don't understand what this property name is for, as shown in the example config.

Less compiling with ExtractTextPlugin

For the life of me, I can't seem to get this to work with less-loader and the ExtractTextPlugin when running the webpack-dev-server.

Here is my config file

    var path = require('path');
    var webpack = require('webpack');
    var LessPluginCleanCSS = require('less-plugin-clean-css');
    var ExtractTextPlugin = require('extract-text-webpack-plugin');
    module.exports = {
      entry: path.resolve(__dirname,'./src/www/js/app/app.js'),
      output: {
        path: './src/www',
        filename: 'bundle.js',
      },
      stats: {
        colors: true,
        modules: true,
        reasons: true
      },
      progress: true, 
      failOnError:false, 
      watch: true,
      plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.ProvidePlugin({
          $: 'jquery',
          jQuery: 'jquery',
          Hammer: 'hammer',
           dust: 'dustjs-linkedin',
         }),
        new ExtractTextPlugin('src/www/css/app/app.css', {
          allChunks: true
        })
      ],
      module: {
        loaders: [
          { test: /\.less$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader!less-loader')},
          { test: /\.html$/, loader: 'dust-loader-complete', exclude: /node_modules/, query: { verbose: true } }
        ]
      }

Been at this for a while with various configurations. Any suggestions

less task / grunt-webpack as grunt-less replacement

Maybe it's because I don't understand/like webpack's loaders, but I'd like to keep that task seperated from the JavaScript compiling.
Still, webpack leverages that ability to compile less files, so why shouldn't it be able to replace grunt-less?

grunt.js:

   webpack: {
          style: { src: "less/style.less", dest: "static/style.css" }
   }

Custom loader failing using Grunt

Thanks for this plugin.

I am attempting to use jsx-loader in my grunt task but it throws an error on parsing the JSX to JS for some reason. All works fine using command line but fails within Grunt. Example usage for command line is here.

Here is the failing task:

webpack: {
  app: {
    loaders: [{
      test: /\.css$/,
      loader: 'style!css'
    }, {
      test: /\.gif/,
      loader: 'url-loader?limit=10000&minetype=image/gif'
    }, {
      test: /\.jpg/,
      loader: 'url-loader?limit=10000&minetype=image/jpg'
    }, {
      test: /\.png/,
      loader: 'url-loader?limit=10000&minetype=image/png'
    }, {
      test: /\.js$/,
      loader: 'jsx-loader'
    }],
    entry: './<%= pkg.src %>/scripts/main.js',
    output: {
      path: './<%= pkg.src %>/scripts/',
      filename: 'bundle.js'
    },
    debug: true,
    stats: {
      colors: true,
      reasons: true
    }
  }
}

The error is Module parse failed and is at the point of JSX syntax. I can pull together an example on Github no problem if needed to help clarify the issue. I am hoping I am missing something glaringly obvious.

template strings do not process in Plugins

This..

          new HtmlWebpackPlugin({
            gitHash: '<%= gitinfo.local.branch.current.shortSHA %>', 
            template: 'index.html', // Load a custom template 
            inject: false
          })

results in this html...

 <div id="voterapp" data-githash="&lt;%= gitinfo.local.branch.current.shortSHA %&gt;"></div>

access WebpackDevServer object

I would like to redirect any requests to not found static files to the main index so I can allow the client side JS router handle 404 or re-display the current client side route as the server know nothing about the routing.

I've done this before by accessing this.app within webpack-dev-server/lib/Server.js and adding a final middleware.

grunt-webpack drops the WebpackDevServer object which is what I need access to add the middleware.

Would love to come up with a solution for this. The only option I see right now is to setup a second http server that serves the main html page and use contentBase to proxy to that.

Exposing WebpackDevServer object would solve this issue for me.
Also changing the final routing in WebpackDevServer to be more flexible would also solve this for me.

Any other ideas on this?

How to pass two different config files in grunt-webpack?

HI,
i have two different webpack.config one for server and one for client. Can you please tell me how to get both the configs passed in and get the the web pack built ? i tried to created separate task file for server but i face issues tat grunt will not load the loader. this is how my config files looks like and also grunt file.

Grunt file
'use strict';

module.exports = function (grunt) {
require('load-grunt-config')(grunt, {
configPath: require('path').resolve('tasks')
});

// Register group tasks
grunt.registerTask('build', ['clean', 'babel', 'webpack:build', 'copyto']);
grunt.registerTask('test', [ 'jshint', 'mochacli' ]);

};

Task file
'use strict';

var config = require('../webpack.config'),
webpack = require('webpack');

module.exports = function webpackTask(grunt) {
return {
options: config,
build: {
}
};
};

in the options im looking to pass both the server side config and client side config. Any solution will help me.

Grunt 0.4 Release

I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.

If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.

If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8" as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0" to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.

Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.

Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!

If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.

Thanks, we really appreciate your work!

Can't use different configs in same time

I'm trying to use the next configuration:

webpack: {
     options: require('./node_modules/package1ToBuild/webpack.config.js'),
     package1: {
         //Specified options to override
     },
     package2: {
         //options: I can't use it for this task only!
         //Specified options for second package
     }

The task options is applied for all subtasks so I can't use it to build different packages with different options.

"Circular reference detected" warning on watch

Using grunt-webpack 1.0.8, webpack 1.4.8, extract-text-webpack-plugin 0.3.3, style-loader 0.8.1, css-loader 0.9.0, less-loader 0.7.7, running grunt-wepack on a watch task, the first time the watch task triggers it compiles everything fine, but the second time the watch task triggers it throws the following warning and does not compile anything:

Running "webpack:dev" (webpack) task
Warning: Circular reference detected (.plugins[0].modulesByIdentifier["/src/project/node_modules/css-loader/index.js!/src/project/node_modules/less-loader/index.js!/src/project/ui/src/less/index.less"].chunks[0].modules[0])

This warning appeared after we bump a few dependencies on our project. Previously we had the following versions: grunt-webpack 1.0.8, webpack 1.4.4, extract-text-webpack-plugin 0.2.5, style-loader 0.7.0, css-loader 0.7.1, less-loader 0.7.7 and we didn't experience this warning on the same set of files.

Don't know exactly which module is responsible for this error, but since the error message is specific to grunt, I just post this here.

Production shortcut?

Is there a way to use the production shortcut (https://webpack.github.io/docs/cli.html#production-shortcut-p) with grunt-webpack without manually specifying each plugin in the webpack.config.js or having two different config files?

I currently use one webpack.config.js for dev and production, and use webpack -p to build for production builds instead of specifying the production plugins.

Documentation: clarify how to watch

The documentation says:

The watch option is not valid for compiling with grunt, you have to use the watch function of grunt.

It's not easy to find out how to do that, i.e., how to use grunt's watch function to re-run webpack when files change.

It would be great if the documentation had an explanation or an example.

Success/Progress Feedback

The progress option from the webpack shell is not available, but when the task succeeds, there is no feedback of that either.
I'd like to see a green okay in the grunt output and if possible some progressbar in grunt (which I imagine, might be difficult because of the async nature of the task and multiple concurrent tasks running.

Plugins broken (again)

I just ran an npm update on an old project that worked fine and now the tasks aren't working, specifically, the uglify and dedupe plugins specified in my production task don't run at all. I thought maybe the usage changed with a new version, so I looked at the README and tried the new way of doing it (I was doing it this way before which was working fine, but I guess that's outdated).

Here's my Gruntfile.js:

/*global module:false*/
module.exports = function(grunt) {

    ...

    grunt.loadNpmTasks('grunt-webpack');

    var webpack = require('webpack');


    // Project configuration.
    grunt.initConfig({

        ...

        webpack: {
            options: require("./webpack.config.js"),
            development: {
                devtool: "sourcemap",
                plugins: [
                    new webpack.DefinePlugin({
                        DEBUG: true,
                        PRODUCTION: false
                    })
                ]
            },
            production: {
                plugins: [
                    new webpack.DefinePlugin({
                        DEBUG: false,
                        PRODUCTION: true
                    }),
                    new webpack.optimize.DedupePlugin(),
                    new webpack.optimize.UglifyJsPlugin()
               ]
            },
        },

       ...

    });

    ...
    // production environment
    grunt.registerTask('production', ['clean', 'preprocess:production', 'rsync:static', 'stylus:production', 'webpack:production']);

};

And here's my webpack.config.js:

module.exports = {
    entry: "./js/main.js",
    output: {
        path: __dirname + "/build/js",
        filename: "main.js?[hash]",
        chunkFilename: "[hash]/js/[id].js",
    },
    resolve: {
        modulesDirectories: ["node_modules", "bower_components", "css", "js", 'templates', 'templates/helpers'],
        fallback: [__dirname+'/templates/helpers'].concat(helperDirectories)
    },
    module: {
        loaders: [
            {test:/\.styl$/, loader:'style-loader!css-loader!stylus-loader'},
            {test:/\.css$/, loader: "style-loader!css-loader"},
            {test:/\.png$/, loader: "url-loader?limit=100000&mimetype=image/png"},
            {test:/\.jpg$/, loader: "file-loader"},
            {test:/\.(handlebars|hbt|hbs)/, loader: "handlebars-loader"}
        ],
        resolve: {
            extensions: ['', '.js', '.styl']
        }
    },
    plugins: [
        new webpack.ResolverPlugin(new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"]))
    ]
}

build fails with an `resolve.alias` called `plugins`

I am working on using webpack for our current project and came up with a strange bug in grunt-webpack.
We have a modular structure and some modules are called plugins. They are found in a subdirectory we resolved before with a requirejs configuration. Now with webpack I created an alias in resolve.alias like plugins: 'source/plugins'. With webpack used globally everything works fine, but when used with grunt-webpack I get a strange undefined is not a function error from grunt.
grunt webpack --stack prints out this (shortened):

Warning: undefined is not a function Use --force to continue.
TypeError: undefined is not a function
  at fixPlugins (C:\Users\foellerich\Git\epages-ui\node_modules\grunt-webpack\lib\getWithPlugins.js:25:31)
  at C:\Users\foellerich\Git\epages-ui\node_modules\grunt-webpack\lib\getWithPlugins.js:43:6
  at Array.forEach (native)
  at fixPlugins (C:\Users\foellerich\Git\epages-ui\node_modules\grunt-webpack\lib\getWithPlugins.js:41:21)
  at C:\Users\foellerich\Git\epages-ui\node_modules\grunt-webpack\lib\getWithPlugins.js:43:6
  at Array.forEach (native)
[...]

When renaming the alias at least this strange behavior is fixed. It seems as if the fixPlugins-method is crawling the whole config for the key plugins and then tries to resolve it as a plugin, even if it is just an alias.

Context caching bug when running Grunt watch

When the following conditions are true grunt-webpack generates a bundle is with mismatched ids in some of the __webpack_require__ statements.

  1. Caching is enabled.
  2. The webpack task is configured to run from a watch task.
  3. The context feature of webpack is used i.e.var template = require('templates/' + name); See the docs http://webpack.github.io/docs/context.html.

Here is a repo with a simple example and steps to reproduce:

https://github.com/asprouse/grunt-webpack-bug

Can't use function as a plugin

The code that fixes up plugins to bypass grunt processing uses Object.create(). It might be better if it checked for function type first and left that plugin as is. Otherwise, it's not a function that gets passed to webpack and it fails to call apply().

Can I use text-replacement during serve and build...

How do I replace a specific piece of code during the serve and build process.
Example:
original: @@replace_this

dev: http://localhost:8080/
build: /?c=

It seems logical to create a configuration object then use a environment variable to specify either dev or build but I have no idea how to do this. Can this be a grunt task such as:

https://www.npmjs.com/package/grunt-text-replace
https://github.com/outaTiME/grunt-replace

or am I looking at this the wrong way?
I am using generator-react-webpack which has a grunt task that creates a single application.js file during build.

Wish there was a list were I could ask this but I did not find one in the documentation.

grunt-webpack yielding inconsistent results

To make a long story short, when calling grunt-webpack from git bash on windows 10, the use of the cd bash command prior to calling grunt impacts the result.

I have a build.sh as follows:

if [ "$1" == "d" ] || [ "$1" == "dev" ] || [ "$1" == "development" ]
then
    export NODE_ENV="development"
elif [ "$1" == "t" ] || [ "$1" == "test" ]
then
    export NODE_ENV="test"
elif [ "$1" == "p" ] || [ "$1" == "prod" ] || [ "$1" == "production" ]
then
    export NODE_ENV="production"
fi

# first change directory to script directory
cd "$(dirname "$0")"

# delete build
rm -f ./webapp/public/build/*
if [ -d ./www/build ]; then rm -f ./www/build/*; fi

# rebuild
grunt build

and a gruntfile.js including:

webpack: {
    options: webpackConfig,
    build: {
        cache: false,
        plugins: webpackConfig.plugins.concat(
            new webpack.optimize.DedupePlugin(),
            new webpack.optimize.UglifyJsPlugin()
            // new webpack.optimize.AggressiveMergingPlugin() // Note: merges app.culture.fr.chunk.js
        )
    }
},

The issue is depending from which directory build.sh p is called, it either produces (project root):

!function(e){function t(i){if(o[i])return o[i].exports;var r=o[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i=window.webpackJsonp;window.webpackJsonp=function(n,a){for(var l,s,d=0,p=[];d<n.length;d++)s=n[d],r[s]&&p.push.apply(p,r[s]),r[s]=0;for(l in a)e[l]=a[l];for(i&&i(n,a);p.length;)p.shift().call(null,t);return a[0]?(o[0]=0,t(0)):void 0};var o={},r={27:0};t.e=function(e,i){if(0===r[e])return i.call(null,t);if(void 0!==r[e])r[e].push(i);else{r[e]=[i];var o=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.charset="utf-8",n.async=!0,n.src=t.p+""+({0:"editor",1:"app.culture.en",2:"app.culture.fr",3:"app.theme.black",4:"app.theme.blueopal",5:"app.theme.bootstrap",6:"app.theme.default",7:"app.theme.fiori",8:"app.theme.flat",9:"app.theme.highcontrast",10:"app.theme.material",11:"app.theme.materialblack",12:"app.theme.metro",13:"app.theme.metroblack",14:"app.theme.moonlight",15:"app.theme.nova",16:"app.theme.office365",17:"app.theme.silver",18:"app.theme.uniform",19:"error",20:"finder",21:"home",23:"player",24:"summary",25:"user",26:"kidoju"}[e]||e)+".chunk.js?v=0.2.14",o.appendChild(n)}},t.m=e,t.c=o,t.p="https://cdn.kidoju.com/build/"}({205:function(e,t){e.exports=function(){var e=[];return
...

or (any other directory)

!function(e){function t(i){if(o[i])return o[i].exports;var r=o[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i=window.webpackJsonp;window.webpackJsonp=function(n,a){for(var l,s,d=0,p=[];d<n.length;d++)s=n[d],r[s]&&p.push.apply(p,r[s]),r[s]=0;for(l in a){var c=a[l];switch(typeof c){case"object":e[l]=function(t){var i=t.slice(1),o=t[0];return function(t,r,n){e[o].apply(this,[t,r,n].concat(i))}}(c);break;case"function":e[l]=c;break;default:e[l]=e[c]}}for(i&&i(n,a);p.length;)p.shift().call(null,t);return a[0]?(o[0]=0,t(0)):void 0};var o={},r={27:0};t.e=function(e,i){if(0===r[e])return i.call(null,t);if(void 0!==r[e])r[e].push(i);else{r[e]=[i];var o=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.charset="utf-8",n.async=!0,n.src=t.p+""+({0:"editor",1:"app.culture.en",2:"app.culture.fr",3:"app.theme.black",4:"app.theme.blueopal",5:"app.theme.bootstrap",6:"app.theme.default",7:"app.theme.fiori",8:"app.theme.flat",9:"app.theme.highcontrast",10:"app.theme.material",11:"app.theme.materialblack",12:"app.theme.metro",13:"app.theme.metroblack",14:"app.theme.moonlight",15:"app.theme.nova",16:"app.theme.office365",17:"app.theme.silver",18:"app.theme.uniform",19:"error",20:"finder",21:"home",23:"player",24:"summary",25:"user",26:"kidoju"}[e]||e)+".chunk.js?v=0.2.14",o.appendChild(n)}},t.m=e,t.c=o,t.p="https://cdn.kidoju.com/build/"}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var i=t.slice(1),o=e[t[0]];return function(e,t,r){o.apply(this,[e,t,r].concat(i))}}(e[t]);break;default:e[t]=e[e[t]]}return e}({205:function(e,t){e.exports=function(){var e=[];return
...

The problem is the second variant is broken with the following extras (when I mean broken, I mean the code won't work in the browser - Uncaught TypeError: Cannot read property 'call' of undefined):

function(t){var i=t.slice(1),o=t[0];return function(t,r,n){e[o].apply(this,[t,r,n].concat(i))}}(c);break;case"function":e[l]=c;break;default:e[l]=e[c]}}

...

function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var i=t.slice(1),o=e[t[0]];return function(e,t,r){o.apply(this,[e,t,r].concat(i))}}(e[t]);break;default:e[t]=e[e[t]]}return e}

I am running these scripts from the latest version of git bash on Windows 10. I have tried setting environmental variables like PWD, OLDPWD and dirname $0 to change the contextual directory without much success.

Is there a way to force the first variant from any directory?

devtool doesn't work when running grunt webpack-dev-server

running webpack-dev-server from an NPM script successfully adds webpack:// source files to the page:

"scripts": {
    "pages": "grunt build:dev",
    "debug-server": "webpack-dev-server --config webpack.config.dev.js --content-base dist/docs --devtool eval --progress --colors"
  },

When i run npm run debug-server, i see the module src files attached to the page:
webpack src files

running what should be the equivalent from grunt does not attach the src files:

    "webpack-dev-server": {
      options: {
        webpack: webpackDevConfig
      },
      start: {
        contentBase: 'dist/docs',
        keepAlive: true,
        progress: true,
        debtool: 'eval',
        debug: true
      }
    },

Here's my webpack config:

'use strict';

var path = require('path'),
    Chunk = require("webpack/lib/optimize/CommonsChunkPlugin"),
    npmConfig = require('./package.json');

module.exports = {
  entry: {
    // Define Entrypoints for each styleguide module
    Forms: ['./docs/modules/Forms.js'],
    Buttons: ['./docs/modules/Buttons.js'],
    Popups: ['./docs/modules/Popups.js'],
    Nav: ['./docs/modules/Nav.js'],
    Tables: ['./docs/modules/Tables.js'],
    Widgets: ['./docs/modules/Widgets.js']
  },
  output: {
    filename: '[name].js',
    sourceMapFilename: "[file].map",
    path: npmConfig.siteRoot + '/scripts',
    publicPath: '/scripts/',
  },
  // externals: {
  //   'react': 'React'
  // },
  debug: true,
  devTool: 'eval',
  resolve: {
    root: [
      path.resolve(__dirname, './src/components'),
      path.resolve(__dirname, './src'),
      path.resolve(__dirname, './node_modules/react-widgets/lib')
    ],
    extensions: ['', '.js', '.jsx'],
  },
  plugins: [
    // Factor common modules into XCommon.js
    new Chunk("XCommon", "XCommon.js")
  ],
  module: {
    loaders: [
      // Expose React as a global
      { test: require.resolve("react/addons"), loader: "expose?React" },
      {
        test: /\.jsx$/,
        loader: 'jsx-loader?harmony'
        // loader: 'react-hot!jsx-loader?harmony'
      }, {
        test: /\.scss/,
        loader: 'style!css!autoprefixer!sass?outputStyle=expanded&' +
          'imagePath=' + npmConfig.vDir + '/images&' +
          'includePaths[]=' +
              (path.resolve(__dirname, './node_modules/foundation-sandboxed/src')) + '&' +
          'includePaths[]=' +
              (path.resolve(__dirname, './fonts')) + '&' +
          'includePaths[]=' +
              (path.resolve(__dirname, './images')) + '&' +
          'includePaths[]=' +
              (path.resolve(__dirname, './src/scss')) + '&' +
          'includePaths[]=' +
              (path.resolve(__dirname, './src/scss/x-styles'))
      }
    ]
  },
  devServer: {
    contentBase: 'dist/docs',
    devtool: 'eval',
    colors: true,
    progress: true,
    debug: true
  }
};

support using webpack.config.js instead

would be nice, and i'll try and take a look, to support either configuration in the gruntfile or if there is a webpack.config.js in the root of the project, to just use that, or to be able to specify a path to the config file.

an example is the grunt karma task.

Grunt task fails with keepalive & watch, when there is a syntax error.

When using the keepalive & watch options, if there is a syntax error in one of the modules, the task fails out

Warning: Task "webpack:dev-build:keepalive" failed. Use --force to continue.

I've tried running the task with the force option, but we just keep dying.

This is somewhat of a deal break for active development environments, where syntax errors are pretty common

Am I doing something wrong here?

Here is my webpack grunt config. I use load-grunt-configs so its in yaml format.

options:
    cache: true
    entry: <%= meta.jsAssets %>/<%= meta.mainJs %>
    output:
        path: <%= meta.jsPublic %>
        filename: <%= meta.mainJs %>
        sourceMapFilename: "[file].map"
    resolve:
        modulesDirectories:
            - <%= meta.jsAssets %>
            - <%= meta.nodeModulesDir %>
build:
    debug: false

dev-build:
    devtool: sourcemap
    debug: true
    watch: true
    keepalive: true

Cannot resolve AMD module?

ERROR in ./~/isotope-layout/js/isotope.js
Module not found: Error: Cannot resolve module 'matches-selector/matches-selector'
 @ ./~/isotope-layout/js/isotope.js 603:2-614:23
...

How to get around this problem?

I don't see anything wrong with the code that fails. But the only way I could make it work, was to manually remove sections if (typeof define === "function" && define.amd)" in isotope.js and it's dependent libraries.

I also tried require('imports?define=>false!isotope-layout'), but this not made any difference.

isotope.js:

601:  if ( typeof define === 'function' && define.amd ) {
602:    // AMD
603:    define( [
604:        'outlayer/outlayer',
605:        'get-size/get-size',
606:        'matches-selector/matches-selector',
607:        './item',
608:        './layout-mode',
609:        // include default layout modes
610:        './layout-modes/masonry',
611:        './layout-modes/fit-rows',
612:        './layout-modes/vertical'
613:      ],
614:      isotopeDefinition );
615:  } else if ( typeof exports === 'object' ) {
616:    // CommonJS
617:    module.exports = isotopeDefinition(
618:      require('outlayer'),
619:      require('get-size'),
620:      require('desandro-matches-selector'),
621:      require('./item'),
622:      require('./layout-mode'),
623:      // include default layout modes
624:      require('./layout-modes/masonry'),
625:      require('./layout-modes/fit-rows'),
626:      require('./layout-modes/vertical')
627:    );
628:  }

My Setup:
package.json:

...
  "devDependencies": { 
    "isotope-layout": "^2.1.1", 
    "webpack": "^1.7.3" 
  }
}

webpack.config.js:

module.exports = {
    entry: {
        app: './index.js'
    },
    output: {
          path: './dist',
          filename: 'bundle.js',
    }
};

Looking for hot-update.json files in the wrong place

I'm using a virtual machine to serve my webpack-dev-server and everything seems to be working just great except that the webpack-dev-server.js script trys to fetch my hot-update.json using my window.location.hostname, Rather than the ip address everything else is loaded from.

GET http://mysite.dev/b3ed7794aa51bd32ab93.hot-update.json 404 (Not Found)hotDownloadManifest @ bundle.js:26hotCheck @ bundle.js:224check @ dev-server.js:12(anonymous function) @ dev-server.js:56
dev-server.js:28 [HMR] Cannot find update. Need to do a full reload!
dev-server.js:29 [HMR] (Probably because of restarting the webpack-dev-server)
client:31 [WDS] Nothing changed.

When I check the virtual machine ip/port the hot update is there. http://192.168.56.10:8080/0.e71cbe1b6f2760378f0d.hot-update.js

How can I tell webpack to look for the hot update files at this location?

I'm embedding this script into my nginx served html page

<script src="http://192.168.56.10:8080/bundle.js"></script>

here is my webpack-dev-server.js config file.

var webpack = require("webpack");
var webpackConfig = require("../webpack.config.js");
module.exports = {
    options: {
        webpack: webpackConfig,
        publicPath: "/",
    },
    default: {
        output: {
            publicPath: "http://192.168.56.10:8080/",
        },
        webpack: {
            devtool: "eval",
            debug: true,
        },
        host: "192.168.56.10",
        hot: true,
        inline: true,
        keepalive: true,
        watchOptions: {
            poll: 1000,
        },
    }
};


And in case its needed my webpack.config.js

var path = require("path");
var webpack = require("webpack");
module.exports = {
    cache: true,
    entry: {
        App: [
            path.join(__dirname, "assets/js/app.js"),
        ],
    },
    devtool: "cheap-module-source-map",
    output: {
        path: path.join(__dirname, "public/js"),
        filename: "bundle.js",
        sourceMapFilename: "[file].map",
    },
    module: {
        loaders: [
            {
                test: /\.scss$/,
                loaders: ["style", "raw", "sass"]
            },
            {
                test: /\.jsx?$/,
                exclude: /(node_modules)/,
                loader: "babel",
                query: {
                    plugins: ["transform-runtime"],
                    presets: ["es2015"],
                },
            },
        ],
    },
    resolve: {
        modulesDirectories: [
            "node_modules",
            "assets/js",
        ],
    },
    plugins: [],
};

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.