From 31efa8af8ce553fd574b4ba7b4ffe654219ff7a8 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 5 Apr 2017 21:29:37 -0400 Subject: [PATCH] Pull webpack out of grunt, simplify. --- client/GruntFile.js | 2 +- client/grunt-tasks/webpack.js | 38 ----------------------------------- client/package.json | 3 +++ 3 files changed, 4 insertions(+), 39 deletions(-) delete mode 100644 client/grunt-tasks/webpack.js diff --git a/client/GruntFile.js b/client/GruntFile.js index f6d2d60909f..74374d155fb 100644 --- a/client/GruntFile.js +++ b/client/GruntFile.js @@ -23,5 +23,5 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-check-modules'); // see the sub directory grunt-tasks/ for individual task definitions grunt.loadTasks( 'grunt-tasks' ); - grunt.registerTask( 'default', [ 'check-modules', 'webpack', 'uglify' ] ); + grunt.registerTask( 'default', [ 'check-modules', 'uglify' ] ); }; diff --git a/client/grunt-tasks/webpack.js b/client/grunt-tasks/webpack.js deleted file mode 100644 index a10d5e270a2..00000000000 --- a/client/grunt-tasks/webpack.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Grunt task to bundle apps using webpack (see also ../webpack.config.js). - */ -module.exports = function( grunt ){ - "use strict"; - - var path = require( 'path' ); - - // there is a taskrunner specifically for this - but it's not straightforward - // and duplicates some of the config/code in webpack.config, - // https://github.com/webpack/grunt-webpack - // http://webpack.github.io/docs/usage-with-grunt.html - - // so we'll use grunt-exec and call the webpack cli instead (until CLI and runner are unified a bit more?) - - grunt.loadNpmTasks( 'grunt-exec' ); - - function webpackCLI(){ - var args = Array.prototype.slice.call( arguments ); - args.unshift( path.join( __dirname, '../node_modules/webpack/bin/webpack.js' ) ); - return args.join( ' ' ); - } - grunt.registerTask( 'webpack', function(){ - grunt.log.writeln( 'bundling webpack apps for production...' ); - grunt.config( 'exec.webpack-production.command', webpackCLI( '-p' ) ); - grunt.task.run( 'exec:webpack-production' ); - }); - grunt.registerTask( 'webpack-dev', function(){ - grunt.log.writeln( 'bundling webpack apps for development...' ); - grunt.config( 'exec.webpack-dev.command', webpackCLI( '-d' ) ); - grunt.task.run( 'exec:webpack-dev' ); - }); - grunt.registerTask( 'webpack-watch', function(){ - grunt.log.writeln( 'bundling webpack apps for development and watching for changes...' ); - grunt.config( 'exec.webpack-watch.command', webpackCLI( '-d', '--watch' ) ); - grunt.task.run( 'exec:webpack-watch' ); - }); -}; diff --git a/client/package.json b/client/package.json index 12139bca819..45d6d98fd52 100644 --- a/client/package.json +++ b/client/package.json @@ -32,6 +32,9 @@ }, "scripts":{ "build": "grunt", + "webpack": "webpack -p", + "webpack-dev": "webpack -d", + "webpack-watch": "webpack -d --watch", "build-style": "grunt style" } }