From fcf683c8a7e18d2233d6454aa44f3825ecc226b8 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 26 Oct 2016 14:13:36 +0100 Subject: [PATCH] Use webpack to copy olm.js Rather than copying olm.js ourselves in package.json, get webpack to do it for us by declaring it as a second entry point. --- .gitignore | 2 +- package.json | 20 +++++++++----------- webpack.config.js | 23 ++++++++++++++++++----- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 200fa33dd1..2806eedff1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,6 @@ /vector/components.css /vector/emojione/ /vector/config.json -/vector/olm.js +/vector/olm.* .DS_Store npm-debug.log diff --git a/package.json b/package.json index dee6ecced4..d6a631707b 100644 --- a/package.json +++ b/package.json @@ -16,21 +16,19 @@ "build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js", "build:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/components.css --no-watch", "build:compile": "babel --source-maps -d lib src", - "build:bundle": "NODE_ENV=production webpack -p lib/vector/index.js vector/bundle.js", - "build:bundle:dev": "webpack --optimize-occurence-order lib/vector/index.js vector/bundle.js", - "build:staticfiles": "cpx -v node_modules/olm/olm.js vector/", - "build": "node scripts/babelcheck.js && npm run build:staticfiles && npm run build:emojione && npm run build:css && npm run build:compile && npm run build:bundle", - "build:dev": "npm run build:staticfiles && npm run build:emojione && npm run build:css && npm run build:compile && npm run build:bundle:dev", + "build:bundle": "NODE_ENV=production webpack -p --progress", + "build:bundle:dev": "webpack --optimize-occurence-order --progress", + "build": "node scripts/babelcheck.js && npm run build:emojione && npm run build:css && npm run build:bundle", + "build:dev": "npm run build:emojione && npm run build:css && npm run build:bundle:dev", "package": "scripts/package.sh", "start:emojione": "cpx \"node_modules/emojione/assets/svg/*\" vector/emojione/svg/ -w", - "start:js": "webpack -w src/vector/index.js vector/bundle.js", - "start:js:prod": "NODE_ENV=production webpack -w src/vector/index.js vector/bundle.js", + "start:js": "webpack -w --progress", + "start:js:prod": "NODE_ENV=production webpack -w --progress", "start:skins:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/components.css", - "start:staticfiles": "cpx -Lwv node_modules/olm/olm.js vector/", "//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:staticfiles\" \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", - "start:prod": "parallelshell \"npm run start:staticfiles\" \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", - "clean": "rimraf lib vector/olm.js vector/bundle.css vector/bundle.js vector/bundle.js.map vector/webpack.css* vector/emojione", + "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\"", + "clean": "rimraf lib vector/olm.* vector/bundle.* vector/emojione", "prepublish": "npm run build:css && npm run build:compile", "test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false", "test:multi": "karma start" diff --git a/webpack.config.js b/webpack.config.js index 95afcfba98..4d5747f689 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,6 +3,18 @@ var webpack = require('webpack'); var ExtractTextPlugin = require("extract-text-webpack-plugin"); module.exports = { + entry: { + "bundle": "./src/vector/index.js", + + // We ship olm.js as a separate lump of javascript. This makes it get + // loaded via a separate