Skip to content

Commit 693bae0

Browse files
committed
chore(system): updates build configuration for gh-pages release
1 parent 5dc89f8 commit 693bae0

File tree

3 files changed

+35
-26
lines changed

3 files changed

+35
-26
lines changed

config/webpack.config.build.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ module.exports = {
169169
inject: true,
170170
template: paths.appHtml,
171171
excludeChunks: ['webcomponent'],
172+
filename: 'index.html',
172173
chunksSortMode: (chunk, other) => {
173174
const chunkOrder = ['polyfill', 'main'];
174175

@@ -187,28 +188,6 @@ module.exports = {
187188
minifyURLs: true,
188189
},
189190
}),
190-
new HtmlWebpackPlugin({
191-
inject: true,
192-
template: paths.webcomponentHtml,
193-
excludeChunks: ['main'],
194-
chunksSortMode: (chunk, other) => {
195-
const chunkOrder = ['polyfill', 'webcomponent'];
196-
197-
return chunkOrder.indexOf(chunk.names[0]) - chunkOrder.indexOf(other.names[0]);
198-
},
199-
minify: {
200-
removeComments: true,
201-
collapseWhitespace: true,
202-
removeRedundantAttributes: true,
203-
useShortDoctype: true,
204-
removeEmptyAttributes: true,
205-
removeStyleLinkTypeAttributes: true,
206-
keepClosingSlash: true,
207-
minifyJS: true,
208-
minifyCSS: true,
209-
minifyURLs: true,
210-
},
211-
}),
212191
new webpack.DefinePlugin(env.stringified),
213192
!isDebugMode() && new UglifyJsPlugin({
214193
uglifyOptions: {

config/webpack.config.release.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
// ----------------------------------------------------------------------------- Dependencies
4+
const HtmlWebpackPlugin = require('html-webpack-plugin');
5+
46
const buildConfig = require('./webpack.config.build');
57
const paths = require('./paths');
68

@@ -23,5 +25,33 @@ module.exports = Object.assign({}, buildConfig, {
2325
entry: {
2426
polyfills: require.resolve('./polyfills'),
2527
webcomponent: paths.webcomponentIndexJs,
26-
}
28+
},
29+
30+
plugins: buildConfig.plugins
31+
.filter(plugin => !(plugin instanceof HtmlWebpackPlugin))
32+
.concat([
33+
new HtmlWebpackPlugin({
34+
inject: true,
35+
template: paths.webcomponentHtml,
36+
excludeChunks: ['main'],
37+
filename: 'index.html',
38+
chunksSortMode: (chunk, other) => {
39+
const chunkOrder = ['polyfill', 'webcomponent'];
40+
41+
return chunkOrder.indexOf(chunk.names[0]) - chunkOrder.indexOf(other.names[0]);
42+
},
43+
minify: {
44+
removeComments: true,
45+
collapseWhitespace: true,
46+
removeRedundantAttributes: true,
47+
useShortDoctype: true,
48+
removeEmptyAttributes: true,
49+
removeStyleLinkTypeAttributes: true,
50+
keepClosingSlash: true,
51+
minifyJS: true,
52+
minifyCSS: true,
53+
minifyURLs: true,
54+
},
55+
})
56+
])
2757
});

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"serve": "serve -l 3001 -s dist",
1616
"prerelease": "yarn lint && node scripts/test.js --env=jsdom && yarn build:release && yarn compile",
1717
"release": "standard-version",
18-
"predeploy": "rimraf dist && node scripts/build.js --dest=dist && yarn react-snap",
19-
"deploy": "gh-pages -d dist",
18+
"predeploy": "rimraf build && node scripts/build.js && yarn react-snap",
19+
"deploy": "gh-pages -d build",
2020
"commitlint": "commitlint -e $GIT_PARAMS",
2121
"lint": "tslint -p tsconfig.json --fix"
2222
},
@@ -167,7 +167,7 @@
167167
"extends": "react-app"
168168
},
169169
"reactSnap": {
170-
"source": "dist"
170+
"source": "build"
171171
},
172172
"husky": {
173173
"hooks": {

0 commit comments

Comments
 (0)