Skip to content

Commit

Permalink
Use stable-module-id-hash webpack plugin (#559)
Browse files Browse the repository at this point in the history
* Use NamedModuleIds for determanistic builds.

* Remove checked-in webpack records from the website
  • Loading branch information
KyleAMathews authored Nov 17, 2016
1 parent 4def590 commit 4293fb5
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5,491 deletions.
4 changes: 3 additions & 1 deletion lib/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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 WebpackStableModuleIdAndHash from 'webpack-stable-module-id-and-hash'

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

Expand Down Expand Up @@ -239,6 +240,8 @@ module.exports = (program, directory, suppliedStage, webpackPort = 1500, pages =
}),
// Ensure module order stays the same. Supposibly fixed in webpack 2.0.
new webpack.optimize.OccurenceOrderPlugin(),
//new WebpackStableModuleIdAndHash({ seed: 9, hashSize: 47 }),
new webpack.NamedModulesPlugin(),
// Enable the offline plugin to add a service worker.
new OfflinePlugin({
AppCache: false,
Expand Down Expand Up @@ -496,7 +499,6 @@ module.exports = (program, directory, suppliedStage, webpackPort = 1500, pages =
resolveLoader: resolveLoader(),
plugins: plugins(),
resolve: resolve(),
recordsPath: `${process.cwd()}/.webpack-records/records-${stage}.json`,
})

return webpackModifyValidate(module, config, stage)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"webpack-dev-server": "^1.16.1",
"webpack-md5-hash": "0.0.5",
"webpack-require": "0.0.16",
"webpack-stable-module-id-and-hash": "^1.0.2",
"webpack-stats-plugin": "^0.1.4",
"webpack-validator": "^2.2.7",
"yaml-js": "^0.1.4"
Expand Down
6 changes: 4 additions & 2 deletions scripts/publish-site.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
echo "=== Installing npm packages for Gatsby"
npm install
echo "=== Building ES5 version of Gatsby"
npm run build
cd www
echo "=== Installing the website dependencies"
npm install
ls ./node_modules | grep stable
echo "=== Overwrite website node_modules with Gatsby's."
cp -r ../node_modules/* ./node_modules/
ls ./node_modules | grep stable
echo "=== Copying built Gatsby to website."
cp -r ../dist ./node_modules/gatsby/
echo "=== Building website"
Expand Down
Loading

0 comments on commit 4293fb5

Please sign in to comment.