Skip to content

Commit

Permalink
Add hard-source-webpack-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed Oct 11, 2016
1 parent bac3428 commit 2c48e5c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
41 changes: 41 additions & 0 deletions lib/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Config from 'webpack-configurator'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import StaticSiteGeneratorPlugin from 'static-site-generator-webpack-plugin'
import { StatsWriterPlugin } from 'webpack-stats-plugin'
import HardSourceWebpackPlugin from 'hard-source-webpack-plugin'

import webpackModifyValidate from './webpack-modify-validate'

Expand Down Expand Up @@ -109,6 +110,16 @@ module.exports = (program, directory, suppliedStage, webpackPort = 1500, pages =
__PREFIX_LINKS__: program.prefixLinks,
__LINK_PREFIX__: JSON.stringify(siteDB().get(`config`).linkPrefix),
}),
new HardSourceWebpackPlugin({
cacheDirectory: '/tmp/[confighash]',
recordsPath: '/tmp/[confighash]/records.json',
configHash: (webpackConfig) => stage,
environmentPaths: {
root: process.cwd(),
directories: ['node_modules'],
files: ['package.json'],
},
}),
]
case `build-css`:
return [
Expand All @@ -120,6 +131,16 @@ module.exports = (program, directory, suppliedStage, webpackPort = 1500, pages =
__LINK_PREFIX__: JSON.stringify(siteDB().get(`config`).linkPrefix),
}),
new ExtractTextPlugin(`styles.css`, { allChunks: true }),
new HardSourceWebpackPlugin({
cacheDirectory: '/tmp/[confighash]',
recordsPath: '/tmp/[confighash]/records.json',
configHash: (webpackConfig) => stage,
environmentPaths: {
root: process.cwd(),
directories: ['node_modules'],
files: ['package.json'],
},
}),
]
case `build-html`:
return [
Expand All @@ -132,6 +153,16 @@ module.exports = (program, directory, suppliedStage, webpackPort = 1500, pages =
__LINK_PREFIX__: JSON.stringify(siteDB().get(`config`).linkPrefix),
}),
new ExtractTextPlugin(`build-html-styles.css`),
new HardSourceWebpackPlugin({
cacheDirectory: '/tmp/[confighash]',
recordsPath: '/tmp/[confighash]/records.json',
configHash: (webpackConfig) => stage,
environmentPaths: {
root: process.cwd(),
directories: ['node_modules'],
files: ['package.json'],
},
}),
]
case `build-javascript`: {
// Get array of page template component names.
Expand Down Expand Up @@ -215,6 +246,16 @@ module.exports = (program, directory, suppliedStage, webpackPort = 1500, pages =
events: true,
},
}),
new HardSourceWebpackPlugin({
cacheDirectory: '/tmp/[confighash]',
recordsPath: '/tmp/[confighash]/records.json',
configHash: (webpackConfig) => stage,
environmentPaths: {
root: process.cwd(),
directories: ['node_modules'],
files: ['package.json'],
},
}),
]
}
default:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"graphql-relay": "^0.4.3",
"hapi": "^8.5.1",
"hapi-graphql": "^1.0.1",
"hard-source-webpack-plugin": "^0.1.0",
"highlight.js": "^9.6.0",
"history": "^2.1.2",
"invariant": "^2.2.1",
Expand Down

0 comments on commit 2c48e5c

Please sign in to comment.