Skip to content

Commit 45734cf

Browse files
Merge pull request #713 from developit/nukedpr
remove script-ext-html-webpack-plugin and add script loading option
2 parents de2a2e7 + 9d55c74 commit 45734cf

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,15 @@ Routes can be exported as a JSON string or an object and can optionally be retur
263263

264264
```js
265265
// prerender-urls.js
266-
module.exports = [{
267-
url: '/',
268-
title: 'Homepage'
269-
}, {
270-
url: '/route/random'
271-
}];
272-
266+
module.exports = [
267+
{
268+
url: '/',
269+
title: 'Homepage',
270+
},
271+
{
272+
url: '/route/random',
273+
},
274+
];
273275
```
274276

275277
#### Template

packages/cli/lib/lib/webpack/render-html-plugin.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const { resolve } = require('path');
22
const { existsSync } = require('fs');
33
const HtmlWebpackExcludeAssetsPlugin = require('html-webpack-exclude-assets-plugin');
4-
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
54
const HtmlWebpackPlugin = require('html-webpack-plugin');
65
const prerender = require('./prerender');
76
const createLoadManifest = require('./create-load-manifest');
@@ -54,6 +53,7 @@ module.exports = function(config) {
5453
Object.assign(params, { url });
5554
return config.prerender ? prerender({ cwd, dest, src }, params) : '';
5655
},
56+
scriptLoading: 'defer'
5757
});
5858
};
5959

@@ -89,9 +89,5 @@ module.exports = function(config) {
8989
.map(conf => new HtmlWebpackPlugin(conf))
9090
.concat([
9191
new HtmlWebpackExcludeAssetsPlugin(),
92-
new ScriptExtHtmlWebpackPlugin({
93-
// inline: 'bundle.js',
94-
defaultAttribute: 'defer',
95-
}),
9692
]);
9793
};

packages/cli/lib/resources/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
%>
3535
<script nomodule>window.fetch||document.write('<script src="<%= htmlWebpackPlugin.files.chunks["polyfills"].entry %>"><\/script>')</script>
3636
<% } else { %>
37-
<script defer src="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %>"></script>
37+
<script <%= htmlWebpackPlugin.options.scriptLoading %> src="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %>"></script>
3838
<script>window.fetch||document.write('<script src="<%= htmlWebpackPlugin.files.chunks["polyfills"].entry %>"><\/script>')</script>
3939
<% } %>
4040
</body>

packages/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
"require-relative": "^0.8.7",
106106
"rimraf": "^2.6.1",
107107
"sade": "^1.4.1",
108-
"script-ext-html-webpack-plugin": "^2.0.1",
109108
"size-plugin": "^1.0.1",
110109
"source-map": "^0.7.2",
111110
"stack-trace": "0.0.10",

0 commit comments

Comments
 (0)