Merge pull request #493 from mozilla/webpack-dev

added webpack-dev-middleware
This commit is contained in:
Danny Coates 2017-08-10 09:29:43 -07:00 committed by GitHub
commit 11ae7f857c
4 changed files with 63 additions and 14 deletions

53
package-lock.json generated
View file

@ -285,9 +285,9 @@
} }
}, },
"aws-sdk": { "aws-sdk": {
"version": "2.94.0", "version": "2.95.0",
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.94.0.tgz", "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.95.0.tgz",
"integrity": "sha1-cEPePvjCTLarS/I18I2H2EFz4XQ=", "integrity": "sha1-JuIdsUlEOx8GOUnch5hPDRdwDmo=",
"requires": { "requires": {
"buffer": "4.9.1", "buffer": "4.9.1",
"crypto-browserify": "1.0.9", "crypto-browserify": "1.0.9",
@ -2047,6 +2047,16 @@
"sha.js": "2.4.8" "sha.js": "2.4.8"
} }
}, },
"cross-env": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-5.0.5.tgz",
"integrity": "sha1-Q4PTZNlmCHPdGFs5ivO/717//vM=",
"dev": true,
"requires": {
"cross-spawn": "5.1.0",
"is-windows": "1.0.1"
}
},
"cross-spawn": { "cross-spawn": {
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
@ -5129,6 +5139,12 @@
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
"dev": true "dev": true
}, },
"is-windows": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz",
"integrity": "sha1-MQ23D3QtJZoWo2kgK1GvhCMzENk=",
"dev": true
},
"isarray": { "isarray": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@ -8523,9 +8539,9 @@
} }
}, },
"redis": { "redis": {
"version": "2.7.1", "version": "2.8.0",
"resolved": "https://registry.npmjs.org/redis/-/redis-2.7.1.tgz", "resolved": "https://registry.npmjs.org/redis/-/redis-2.8.0.tgz",
"integrity": "sha1-fVb3h1uYsgQQtxU58dh47Vjr9Go=", "integrity": "sha512-M1OkonEQwtRmZv4tEWF2VgpG0JWJ8Fv1PhlgT5+B+uNq2cA3Rt1Yt/ryoR+vQNOQcIEgdCdfH0jr3bDpihAw1A==",
"requires": { "requires": {
"double-ended-queue": "2.1.0-0", "double-ended-queue": "2.1.0-0",
"redis-commands": "1.3.1", "redis-commands": "1.3.1",
@ -9819,6 +9835,12 @@
} }
} }
}, },
"time-stamp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-2.0.0.tgz",
"integrity": "sha1-lcakRTDhW6jW9KPsuMOj+sRto1c=",
"dev": true
},
"timed-out": { "timed-out": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
@ -10131,9 +10153,9 @@
} }
}, },
"webpack": { "webpack": {
"version": "3.4.1", "version": "3.5.2",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-3.4.1.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.5.2.tgz",
"integrity": "sha1-TD9PP7MYFVpNsMtqNv8FxWl0GPQ=", "integrity": "sha1-qWAQZuI688gPO/l1j9eUypd48lE=",
"dev": true, "dev": true,
"requires": { "requires": {
"acorn": "5.1.1", "acorn": "5.1.1",
@ -10258,6 +10280,19 @@
} }
} }
}, },
"webpack-dev-middleware": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.12.0.tgz",
"integrity": "sha1-007++y7dp+HTtdvgcolRMhllFwk=",
"dev": true,
"requires": {
"memory-fs": "0.4.1",
"mime": "1.3.4",
"path-is-absolute": "1.0.1",
"range-parser": "1.2.0",
"time-stamp": "2.0.0"
}
},
"webpack-sources": { "webpack-sources": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz",

View file

@ -4,7 +4,7 @@
"version": "1.1.0", "version": "1.1.0",
"author": "Mozilla (https://mozilla.org)", "author": "Mozilla (https://mozilla.org)",
"dependencies": { "dependencies": {
"aws-sdk": "^2.89.0", "aws-sdk": "^2.95.0",
"body-parser": "^1.17.2", "body-parser": "^1.17.2",
"connect-busboy": "0.0.2", "connect-busboy": "0.0.2",
"convict": "^3.0.0", "convict": "^3.0.0",
@ -13,7 +13,7 @@
"helmet": "^3.8.0", "helmet": "^3.8.0",
"mozlog": "^2.1.1", "mozlog": "^2.1.1",
"raven": "^2.1.0", "raven": "^2.1.0",
"redis": "^2.7.1" "redis": "^2.8.0"
}, },
"devDependencies": { "devDependencies": {
"asmcrypto.js": "0.0.11", "asmcrypto.js": "0.0.11",
@ -25,6 +25,7 @@
"babel-preset-es2015": "^6.24.1", "babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1", "babel-preset-stage-2": "^6.24.1",
"browserify": "^14.4.0", "browserify": "^14.4.0",
"cross-env": "^5.0.5",
"css-mqpacker": "^6.0.1", "css-mqpacker": "^6.0.1",
"cssnano": "^3.10.0", "cssnano": "^3.10.0",
"eslint": "^4.3.0", "eslint": "^4.3.0",
@ -49,7 +50,8 @@
"supertest": "^3.0.0", "supertest": "^3.0.0",
"testpilot-ga": "^0.3.0", "testpilot-ga": "^0.3.0",
"webcrypto-liner": "^0.1.25", "webcrypto-liner": "^0.1.25",
"webpack": "^3.4.1" "webpack": "^3.5.2",
"webpack-dev-middleware": "^1.12.0"
}, },
"engines": { "engines": {
"node": ">=8.2.0" "node": ">=8.2.0"
@ -113,7 +115,7 @@
"lint-locales:dev": "npm run lint-locales", "lint-locales:dev": "npm run lint-locales",
"lint-locales:prod": "npm run lint-locales -- --production", "lint-locales:prod": "npm run lint-locales -- --production",
"start": "node server/server", "start": "node server/server",
"test": "npm-run-all test:*", "test": "cross-env NODE_ENV=test npm-run-all test:*",
"test:unit": "mocha test/unit", "test:unit": "mocha test/unit",
"test:server": "mocha test/server", "test:server": "mocha test/server",
"test--browser": "browserify test/frontend/frontend.bundle.js -o test/frontend/bundle.js -d && node test/frontend/driver.js" "test--browser": "browserify test/frontend/frontend.bundle.js -o test/frontend/bundle.js -d && node test/frontend/driver.js"

View file

@ -38,6 +38,17 @@ function prodLangs() {
const availableLanguages = conf.l10n_dev ? allLangs() : prodLangs(); const availableLanguages = conf.l10n_dev ? allLangs() : prodLangs();
if (conf.env === 'development') {
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const config = require('../webpack.config.js');
config.devtool = 'inline-source-map';
const compiler = webpack(config);
app.use(webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath
}));
}
app.engine( app.engine(
'handlebars', 'handlebars',
exphbs({ exphbs({

View file

@ -7,7 +7,8 @@ module.exports = {
}, },
output: { output: {
filename: '[name].js', filename: '[name].js',
path: path.resolve(__dirname, 'public') path: path.resolve(__dirname, 'public'),
publicPath: '/'
}, },
module: { module: {
loaders: [ loaders: [