diff --git a/package.json b/package.json index 7f407d44..52efab04 100644 --- a/package.json +++ b/package.json @@ -38,12 +38,11 @@ "build:dev": "npm run build:emojione && npm run build:css && npm run build:bundle:dev", "dist": "scripts/package.sh", "start:emojione": "cpx \"node_modules/emojione/assets/svg/*\" vector/emojione/svg/ -w", - "start:js": "webpack -w --progress --no-cache-buster", - "start:js:prod": "NODE_ENV=production webpack -w --progress --no-cache-buster", + "start:js": "webpack-dev-server -w --progress", + "start:js:prod": "NODE_ENV=production webpack-dev-server -w --progress", "start:skins:css": "mkdirp build && catw \"src/skins/vector/css/**/*.css\" -o build/components.css", - "//cache": "Note the -c 1 below due to https://code.google.com/p/chromium/issues/detail?id=508270", - "start": "node scripts/babelcheck.js && parallelshell \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", - "start:prod": "parallelshell \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", + "start": "node scripts/babelcheck.js && parallelshell \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\"", + "start:prod": "parallelshell \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\"", "clean": "rimraf build lib vector/olm.* vector/bundle.* vector/emojione vector/index.html", "prepublish": "npm run build:compile", "test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false", @@ -99,7 +98,6 @@ "expect": "^1.16.0", "fs-extra": "^0.30.0", "html-webpack-plugin": "^2.24.0", - "http-server": "^0.8.4", "json-loader": "^0.5.3", "karma": "^0.13.22", "karma-chrome-launcher": "^0.2.3", @@ -117,7 +115,8 @@ "react-addons-test-utils": "^15.0.1", "rimraf": "^2.4.3", "source-map-loader": "^0.1.5", - "webpack": "^1.12.14" + "webpack": "^1.12.14", + "webpack-dev-server": "^1.16.2" }, "optionalDependencies": { "olm": "https://matrix.org/packages/npm/olm/olm-2.0.0.tgz" diff --git a/webpack.config.js b/webpack.config.js index e6a5c96c..5d669bd2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,15 +3,6 @@ var webpack = require('webpack'); var ExtractTextPlugin = require("extract-text-webpack-plugin"); var HtmlWebpackPlugin = require('html-webpack-plugin'); -var cachebuster = true; - -for (var i=0; i < process.argv.length; i++) { - var arg = process.argv[i]; - if (arg == "--no-cache-buster") { - cachebuster = false; - } -} - module.exports = { entry: { "bundle": "./src/vector/index.js", @@ -49,7 +40,7 @@ module.exports = { }, output: { path: path.join(__dirname, "vector"), - filename: "[name]" + (cachebuster ? ".[chunkhash]" : "") + ".js", + filename: "[name].[chunkhash].js", devtoolModuleFilenameTemplate: function(info) { // Reading input source maps gives only relative paths here for // everything. Until I figure out how to fix this, this is a @@ -87,7 +78,7 @@ module.exports = { }), new ExtractTextPlugin( - "[name]" + (cachebuster ? ".[contenthash]" : "") + ".css", + "[name].[contenthash].css", { allChunks: true } @@ -103,7 +94,13 @@ module.exports = { inject: false, }), ], - devtool: 'source-map' + devtool: 'source-map', + + // configuration for the webpack-dev-server + devServer: { + // serve unwebpacked assets from vector. + contentBase: './vector', + }, }; // olm is an optional dependency. Ignore it if it's not installed, to avoid a