Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

build: speed up webpack build using HardSource for caching #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ npm-debug.log.*
# Cypress testing. These will get downloaded as artifacts by buildkite.
cypress/screenshots/
cypress/vidoes/

.cache/
2 changes: 1 addition & 1 deletion app/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ $theme-colors-light: (
@import './components/symbols';
@import './components/codeIntelStatusIndicator';
@import 'node_modules/@sourcegraph/codeintellify/lib/HoverOverlay.scss';
@import 'node_modules/@sourcegraph/react-loading-spinner/lib/LoadingSpinner.css';
@import 'node_modules/@sourcegraph/react-loading-spinner/lib/LoadingSpinner';
@import './extensions-client-common';
6 changes: 3 additions & 3 deletions app/extensions-client-common.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import 'node_modules/@sourcegraph/extensions-client-common/lib/ui/generic/PopoverButton.css';
@import 'node_modules/@sourcegraph/extensions-client-common/lib/ui/generic/Toggle.css';
@import 'node_modules/@sourcegraph/extensions-client-common/lib/ui/generic/PopoverButton';
@import 'node_modules/@sourcegraph/extensions-client-common/lib/ui/generic/Toggle';
@import 'node_modules/@sourcegraph/extensions-client-common/lib/app/CommandList';
@import 'node_modules/@sourcegraph/extensions-client-common/lib/app/ExtensionStatus';
@import 'node_modules/@sourcegraph/extensions-client-common/lib/extensions/manager/ExtensionCard.css';
@import 'node_modules/@sourcegraph/extensions-client-common/lib/extensions/manager/ExtensionCard';

$body-color-light: #2b3750;
$body-color-dark: #f2f4f8;
Expand Down
171 changes: 150 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"get-graphql-schema": "^2.1.1",
"gql2ts": "^1.2.1",
"hard-source-webpack-plugin": "^0.12.0",
"husky": "^0.14.3",
"jade": "^1.11.0",
"node-sass": "^4.9.0",
Expand Down
23 changes: 18 additions & 5 deletions webpack/base.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import sassImportOnce from 'node-sass-import-once'
import HardSourceWebpackPlugin from 'hard-source-webpack-plugin'
import * as path from 'path'
import * as webpack from 'webpack'

Expand Down Expand Up @@ -32,6 +32,23 @@ export default {
filename: '../css/[name].bundle.css',
allChunks: true,
}),
new HardSourceWebpackPlugin({
cachePrune: {
// Ignore the age of cache entries. Without this, the size of
// the cache can balloon past the `sizeThreshold`.
maxAge: 0,
// The cache size needs to be large enough for the build
// artifacts, otherwise the cache will get deleted and rendered
// useless. The build artifacts total ~70MB at the time of
// writing, so 500MB of cache is plenty.
sizeThreshold: 500 * 1024 * 1024,
},
}),
new HardSourceWebpackPlugin.ExcludeModulePlugin([
{
test: /sass-loader/,
},
]),
],
resolve: {
extensions: ['.ts', '.tsx', '.js'],
Expand Down Expand Up @@ -68,10 +85,6 @@ export default {
loader: 'sass-loader',
options: {
includePaths: [__dirname + '/node_modules'],
importer: sassImportOnce,
importOnce: {
css: true,
},
},
},
]),
Expand Down