Skip to content

Commit

Permalink
Use HtmlWebpackHarddiskPlugin to avoid having to build twice when sta…
Browse files Browse the repository at this point in the history
…rting build-hot
  • Loading branch information
tlrobinson committed Apr 5, 2017
1 parent f4fea8a commit 856dc68
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"flow-bin": "^0.37.4",
"fs-promise": "^1.0.0",
"glob": "^7.1.1",
"html-webpack-harddisk-plugin": "^0.1.0",
"html-webpack-plugin": "^2.14.0",
"husky": "^0.13.2",
"image-diff": "^1.6.3",
Expand Down Expand Up @@ -153,7 +154,7 @@
"test-e2e-sauce": "USE_SAUCE=true yarn run test-e2e",
"build": "webpack --bail",
"build-watch": "webpack --watch",
"build-hot": "NODE_ENV=hot webpack --bail && NODE_ENV=hot webpack-dev-server --progress",
"build-hot": "NODE_ENV=hot webpack-dev-server --progress",
"start": "yarn run build && lein ring server",
"storybook": "start-storybook -p 9001",
"precommit": "lint-staged",
Expand Down
13 changes: 10 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var webpackPostcssTools = require('webpack-postcss-tools');

var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
var UnusedFilesWebpackPlugin = require("unused-files-webpack-plugin").default;
var BannerWebpackPlugin = require('banner-webpack-plugin');

Expand Down Expand Up @@ -159,19 +160,25 @@ var config = module.exports = {
filename: '../../index.html',
chunks: ["app-main", "styles"],
template: __dirname + '/resources/frontend_client/index_template.html',
inject: 'head'
inject: 'head',
alwaysWriteToDisk: true,
}),
new HtmlWebpackPlugin({
filename: '../../public.html',
chunks: ["app-public", "styles"],
template: __dirname + '/resources/frontend_client/index_template.html',
inject: 'head'
inject: 'head',
alwaysWriteToDisk: true,
}),
new HtmlWebpackPlugin({
filename: '../../embed.html',
chunks: ["app-embed", "styles"],
template: __dirname + '/resources/frontend_client/index_template.html',
inject: 'head'
inject: 'head',
alwaysWriteToDisk: true,
}),
new HtmlWebpackHarddiskPlugin({
outputPath: __dirname + '/resources/frontend_client/app/dist'
}),
new webpack.DefinePlugin({
'process.env': {
Expand Down
6 changes: 6 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3723,6 +3723,12 @@ html-minifier@^3.2.3:
relateurl "0.2.x"
uglify-js "2.7.x"

html-webpack-harddisk-plugin@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/html-webpack-harddisk-plugin/-/html-webpack-harddisk-plugin-0.1.0.tgz#432024961a21ac668fa2b5dfe24629c60b9c58d7"
dependencies:
mkdirp "^0.5.1"

html-webpack-plugin@^2.14.0:
version "2.28.0"
resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-2.28.0.tgz#2e7863b57e5fd48fe263303e2ffc934c3064d009"
Expand Down

0 comments on commit 856dc68

Please sign in to comment.