API added watch command to package.json

This commit is contained in:
Christopher Joe 2016-09-28 13:16:43 +13:00
parent a08a854c9c
commit 2f4867fef8
3 changed files with 26 additions and 3 deletions

View File

@ -11,6 +11,7 @@
},
"scripts": {
"build": "webpack",
"watch": "webpack --config ./webpack-dev.config.js --watch",
"css": "WEBPACK_CHILD=css webpack",
"lock": "npm-shrinkwrap --dev",
"test": "NODE_PATH=\"./client/src:./admin/client/src\" jest",

25
webpack-dev.config.js Normal file
View File

@ -0,0 +1,25 @@
const webpack = require('webpack');
const Config = require('./webpack.config');
if (Array.isArray(Config)) {
const jsConfig = Config.find((item) => item.name === 'js');
jsConfig.plugins = [
new webpack.ProvidePlugin({
jQuery: 'jQuery',
$: 'jQuery',
}),
// Most vendor libs are loaded directly into the 'vendor' bundle (through require() calls in vendor.js).
// This ensures that any further require() calls in other bundles aren't duplicating libs.
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
}),
];
for (var i = 0; i < Config.length; i++) {
Config[i].devtool = 'source-map';
}
}
module.exports = Config;

View File

@ -88,7 +88,6 @@ const config = [
config: 'Config',
'lib/Router': 'Router',
},
devtool: 'source-map',
module: {
loaders: [
{
@ -152,7 +151,6 @@ const config = [
path: 'admin/client/dist',
filename: '[name].css',
},
devtool: 'source-map',
module: {
loaders: [
{
@ -202,7 +200,6 @@ const config = [
path: './',
filename: '[name].css',
},
devtool: 'source-map',
module: {
loaders: [
{