@zohodesk/react-cli 1.1.19-exp.1 → 1.1.19-exp.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,6 +26,12 @@ const defaultHTMLMiniFyOption = {
26
26
  removeStyleLinkTypeAttributes: true,
27
27
  useShortDoctype: true
28
28
  };
29
+ const defaultScriptLoadingStrategy = 'defer';
30
+
31
+ function getScriptLoadingStrategy(scriptLoadingStategey) {
32
+ const allowedScriptLoadingStrategies = ['blocking', 'defer'];
33
+ return allowedScriptLoadingStrategies.includes(scriptLoadingStategey) ? scriptLoadingStategey : defaultScriptLoadingStrategy;
34
+ }
29
35
 
30
36
  function configHtmlWebpackPlugins(plugins, {
31
37
  enableChunkHash = false,
@@ -33,7 +39,8 @@ function configHtmlWebpackPlugins(plugins, {
33
39
  inject,
34
40
  crossorigin,
35
41
  hasEFC,
36
- minify: minifyHtmlOptions = false
42
+ minify: minifyHtmlOptions = false,
43
+ scriptLoadingStrategey
37
44
  }) {
38
45
  const optionsHtmlWebpack = {
39
46
  chunksSortMode: 'none',
@@ -44,7 +51,7 @@ function configHtmlWebpackPlugins(plugins, {
44
51
  // ? minifyHtmlOptions
45
52
  // : minifyHtmlOptions,,
46
53
  templateParameters: _common.templateParameters,
47
- scriptLoading: 'defer',
54
+ scriptLoading: getScriptLoadingStrategy(scriptLoadingStrategey),
48
55
  inject: inject
49
56
  };
50
57
 
@@ -60,7 +60,8 @@ const getDevPlugins = (options, publicPath) => {
60
60
  mode
61
61
  },
62
62
  htmlTemplate: {
63
- inject
63
+ inject,
64
+ scriptLoadingStrategey
64
65
  },
65
66
  crossorigin
66
67
  },
@@ -166,7 +167,8 @@ const getDevPlugins = (options, publicPath) => {
166
167
  minify: false,
167
168
  inject,
168
169
  crossorigin,
169
- hasEFC
170
+ hasEFC,
171
+ scriptLoadingStrategey
170
172
  });
171
173
 
172
174
  if (hasEFC) {
@@ -78,7 +78,8 @@ const getProdPlugins = (options, publicPath = '') => {
78
78
  } = options.app;
79
79
  const {
80
80
  inject,
81
- minify: minifyHtmlOptions
81
+ minify: minifyHtmlOptions,
82
+ scriptLoadingStrategey
82
83
  } = htmlTemplate;
83
84
  const {
84
85
  i18n
@@ -176,6 +177,7 @@ const getProdPlugins = (options, publicPath = '') => {
176
177
  folder,
177
178
  inject,
178
179
  minify: minifyHtmlOptions,
180
+ scriptLoadingStrategey,
179
181
  crossorigin,
180
182
  hasEFC
181
183
  });
@@ -322,7 +322,8 @@ var _default = {
322
322
  },
323
323
  htmlTemplate: {
324
324
  minify: null,
325
- inject: true
325
+ inject: true,
326
+ scriptLoadingStrategey: ''
326
327
  },
327
328
  removePropTypes: false,
328
329
  customChunksBaseConfig: null,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.19-exp.1",
3
+ "version": "1.1.19-exp.3",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.19-exp.1",
3
+ "version": "1.1.19-exp.3",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",