Skip to content

Commit a6c794c

Browse files
authored
Merge pull request element-hq#2542 from vector-im/rav/webpack-dev-server
Use webpack-dev-server instead of http-server
2 parents 4dab36d + ff46258 commit a6c794c

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

‎package.json‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@
3535
"build:dev": "npm run build:emojione && npm run build:css && npm run build:bundle:dev",
3636
"dist": "scripts/package.sh",
3737
"start:emojione": "cpx \"node_modules/emojione/assets/svg/*\" vector/emojione/svg/ -w",
38-
"start:js": "webpack -w --progress --no-cache-buster",
39-
"start:js:prod": "NODE_ENV=production webpack -w --progress --no-cache-buster",
38+
"start:js": "webpack-dev-server -w --progress",
39+
"start:js:prod": "NODE_ENV=production webpack-dev-server -w --progress",
4040
"start:skins:css": "mkdirp build && catw \"src/skins/vector/css/**/*.css\" -o build/components.css",
41-
"//cache": "Note the -c 1 below due to https://code.google.com/p/chromium/issues/detail?id=508270",
42-
"start": "node scripts/babelcheck.js && parallelshell \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\" \"http-server -c 1 vector\"",
43-
"start:prod": "parallelshell \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\" \"http-server -c 1 vector\"",
41+
"start": "node scripts/babelcheck.js && parallelshell \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\"",
42+
"start:prod": "parallelshell \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\"",
4443
"clean": "rimraf build lib vector/olm.* vector/bundle.* vector/emojione vector/index.html",
4544
"prepublish": "npm run build:compile",
4645
"test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false",
@@ -95,7 +94,6 @@
9594
"expect": "^1.16.0",
9695
"fs-extra": "^0.30.0",
9796
"html-webpack-plugin": "^2.24.0",
98-
"http-server": "^0.8.4",
9997
"json-loader": "^0.5.3",
10098
"karma": "^0.13.22",
10199
"karma-chrome-launcher": "^0.2.3",
@@ -113,7 +111,8 @@
113111
"react-addons-test-utils": "^15.0.1",
114112
"rimraf": "^2.4.3",
115113
"source-map-loader": "^0.1.5",
116-
"webpack": "^1.12.14"
114+
"webpack": "^1.12.14",
115+
"webpack-dev-server": "^1.16.2"
117116
},
118117
"optionalDependencies": {
119118
"olm": "https://matrix.org/packages/npm/olm/olm-2.0.0.tgz"

‎webpack.config.js‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ var webpack = require('webpack');
33
var ExtractTextPlugin = require("extract-text-webpack-plugin");
44
var HtmlWebpackPlugin = require('html-webpack-plugin');
55

6-
var cachebuster = true;
7-
8-
for (var i=0; i < process.argv.length; i++) {
9-
var arg = process.argv[i];
10-
if (arg == "--no-cache-buster") {
11-
cachebuster = false;
12-
}
13-
}
14-
156
module.exports = {
167
entry: {
178
"bundle": "./src/vector/index.js",
@@ -49,7 +40,7 @@ module.exports = {
4940
},
5041
output: {
5142
path: path.join(__dirname, "vector"),
52-
filename: "[name]" + (cachebuster ? ".[chunkhash]" : "") + ".js",
43+
filename: "[name].[chunkhash].js",
5344
devtoolModuleFilenameTemplate: function(info) {
5445
// Reading input source maps gives only relative paths here for
5546
// everything. Until I figure out how to fix this, this is a
@@ -84,7 +75,7 @@ module.exports = {
8475
}),
8576

8677
new ExtractTextPlugin(
87-
"[name]" + (cachebuster ? ".[contenthash]" : "") + ".css",
78+
"[name].[contenthash].css",
8879
{
8980
allChunks: true
9081
}
@@ -100,7 +91,13 @@ module.exports = {
10091
inject: false,
10192
}),
10293
],
103-
devtool: 'source-map'
94+
devtool: 'source-map',
95+
96+
// configuration for the webpack-dev-server
97+
devServer: {
98+
// serve unwebpacked assets from vector.
99+
contentBase: './vector',
100+
},
104101
};
105102

106103
// olm is an optional dependency. Ignore it if it's not installed, to avoid a

0 commit comments

Comments
 (0)