@zohodesk/react-cli 1.1.22-exp.1 → 1.1.22-exp.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +0 -22
- package/lib/babel/cmjs-plugins-presets.js +1 -1
- package/lib/babel/es-plugins-presets.js +1 -1
- package/lib/configs/resolvers.js +3 -1
- package/lib/configs/webpack.prod.config.js +1 -4
- package/lib/loaders/workerLoader.js +24 -39
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +1 -57
- package/lib/pluginUtils/getDevPlugins.js +2 -4
- package/lib/pluginUtils/getProdPlugins.js +1 -3
- package/lib/plugins/EventsHandlingPlugin.js +2 -2
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +1 -1
- package/lib/schemas/index.js +2 -5
- package/lib/utils/addModulePathAlias.js +23 -0
- package/lib/utils/index.js +0 -14
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +0 -108
- package/lib/utils/typeCheck.js +0 -10
package/README.md
CHANGED
@@ -59,28 +59,6 @@ Now to run app
|
|
59
59
|
```
|
60
60
|
- The Memory leak issue while downloading i18n and CSS files has been fixed
|
61
61
|
|
62
|
-
|
63
|
-
# 1.1.20-exp.1
|
64
|
-
|
65
|
-
**Changes**
|
66
|
-
|
67
|
-
- Added memory leak fixes for script, links tags
|
68
|
-
|
69
|
-
**Feature**
|
70
|
-
- Custom Script loading strategy support for initial html script tags.
|
71
|
-
|
72
|
-
# 1.1.19-exp.18
|
73
|
-
|
74
|
-
**Changes**
|
75
|
-
|
76
|
-
- To do further build size optimization by utilizing webpack provided config.
|
77
|
-
|
78
|
-
```
|
79
|
-
innerGraph: true,
|
80
|
-
usedExports: true,
|
81
|
-
sideEffects: true
|
82
|
-
```
|
83
|
-
|
84
62
|
# 1.1.20 (27-5-2024)
|
85
63
|
|
86
64
|
**Feature**
|
@@ -23,7 +23,7 @@ const {
|
|
23
23
|
const isProd = mode.toLowerCase() === 'prod';
|
24
24
|
const defaultPlugins = [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
25
25
|
__DOCS__: false
|
26
|
-
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import')];
|
26
|
+
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('../utils/addModulePathAlias')];
|
27
27
|
const resolvedPlugins = [];
|
28
28
|
babelPlugins.forEach(plugin => {
|
29
29
|
resolvedPlugins.push(require.resolve(plugin));
|
@@ -24,7 +24,7 @@ const {
|
|
24
24
|
const isProd = mode.toLowerCase() === 'prod';
|
25
25
|
const defaultPlugins = [[require.resolve('babel-plugin-transform-define'), isProd ? {
|
26
26
|
__DOCS__: false
|
27
|
-
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import')];
|
27
|
+
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('../utils/addModulePathAlias')];
|
28
28
|
const resolvedPlugins = [];
|
29
29
|
babelPlugins.forEach(plugin => {
|
30
30
|
resolvedPlugins.push(require.resolve(plugin));
|
package/lib/configs/resolvers.js
CHANGED
@@ -21,6 +21,7 @@ function moduleResolver(options) {
|
|
21
21
|
moduleResolvePath,
|
22
22
|
disableES5Transpile
|
23
23
|
} = options.app;
|
24
|
+
const customAlias = options.app.alias;
|
24
25
|
let required = moduleResolvePath && (0, _requireLocalOrGlobal.requireLocal)(moduleResolvePath);
|
25
26
|
|
26
27
|
if (!required) {
|
@@ -32,10 +33,11 @@ function moduleResolver(options) {
|
|
32
33
|
}
|
33
34
|
|
34
35
|
const nodeModulesPath = required ? required.nodeModulesPath : _client_packages_group.nodeModulesPath;
|
36
|
+
const totalAlias = Object.assign({}, _libAlias.libAlias, customAlias);
|
35
37
|
return {
|
36
38
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
37
39
|
modules: [nodeModulesPath, _constants.cliNodeModulesPath, 'node_modules'].filter(Boolean),
|
38
|
-
alias: disableES5Transpile ?
|
40
|
+
alias: disableES5Transpile ? totalAlias : {} // alias: { ...libAlias, ...clientDependenies }
|
39
41
|
|
40
42
|
};
|
41
43
|
}
|
@@ -103,10 +103,7 @@ module.exports = {
|
|
103
103
|
// exclude: /\/smap/
|
104
104
|
// })
|
105
105
|
// ],
|
106
|
-
moduleIds: 'named'
|
107
|
-
usedExports: true,
|
108
|
-
// innerGraph: true, // this property present on webpack 5
|
109
|
-
sideEffects: true
|
106
|
+
moduleIds: 'named'
|
110
107
|
},
|
111
108
|
stats: {
|
112
109
|
children: false,
|
@@ -19,32 +19,32 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
19
19
|
/* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
|
20
20
|
import ExternalsPlugin from 'webpack/lib/ExternalsPlugin'; */
|
21
21
|
const schema = {
|
22
|
-
type: 'object',
|
23
|
-
properties: {
|
24
|
-
publicPath: {
|
25
|
-
anyOf: [{
|
26
|
-
type: 'string'
|
22
|
+
'type': 'object',
|
23
|
+
'properties': {
|
24
|
+
'publicPath': {
|
25
|
+
'anyOf': [{
|
26
|
+
'type': 'string'
|
27
27
|
}, {
|
28
|
-
instanceof: 'Function'
|
28
|
+
'instanceof': 'Function'
|
29
29
|
}]
|
30
30
|
},
|
31
|
-
filename: {
|
32
|
-
anyOf: [{
|
33
|
-
type: 'string',
|
34
|
-
minLength: 1
|
31
|
+
'filename': {
|
32
|
+
'anyOf': [{
|
33
|
+
'type': 'string',
|
34
|
+
'minLength': 1
|
35
35
|
}, {
|
36
|
-
instanceof: 'Function'
|
36
|
+
'instanceof': 'Function'
|
37
37
|
}]
|
38
38
|
},
|
39
|
-
chunkFilename: {
|
40
|
-
type: 'string',
|
41
|
-
minLength: 1
|
39
|
+
'chunkFilename': {
|
40
|
+
'type': 'string',
|
41
|
+
'minLength': 1
|
42
42
|
},
|
43
|
-
esModule: {
|
44
|
-
type: 'boolean'
|
43
|
+
'esModule': {
|
44
|
+
'type': 'boolean'
|
45
45
|
}
|
46
46
|
},
|
47
|
-
additionalProperties: false
|
47
|
+
'additionalProperties': false
|
48
48
|
}; // eslint-disable-next-line
|
49
49
|
|
50
50
|
function loader() {}
|
@@ -112,40 +112,25 @@ function pitch(request) {
|
|
112
112
|
}
|
113
113
|
|
114
114
|
function workerCode() {
|
115
|
-
if (this.workerInstance) {
|
116
|
-
return this.workerInstance;
|
117
|
-
}
|
118
|
-
|
119
115
|
let blob;
|
120
116
|
|
121
117
|
try {
|
122
118
|
blob = new Blob([`importScripts('${this.workerUrl}');`], {
|
123
|
-
type: 'application/javascript'
|
119
|
+
'type': 'application/javascript'
|
124
120
|
});
|
125
121
|
} catch (e1) {
|
126
122
|
throw new Error(e1);
|
127
123
|
}
|
128
124
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
return
|
125
|
+
let url = window.URL || window.webkitURL;
|
126
|
+
let blobUrl = url.createObjectURL(blob);
|
127
|
+
let worker = new Worker(blobUrl);
|
128
|
+
return worker;
|
133
129
|
}
|
134
130
|
|
135
|
-
return cb(null,
|
136
|
-
workerInstance: null, \n
|
131
|
+
return cb(null, `${options.esModule ? 'export default' : 'module.exports ='} {\n
|
137
132
|
workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
|
138
133
|
getInstance: ${workerCode} \n
|
139
|
-
}
|
140
|
-
workerObj.getInstance();
|
141
|
-
${options.esModule ? 'export default' : 'module.exports ='} workerObj;
|
142
|
-
`); // return cb(
|
143
|
-
// null,
|
144
|
-
// `${options.esModule ? 'export default' : 'module.exports ='} {\n
|
145
|
-
// workerInstance: null, \n
|
146
|
-
// workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
|
147
|
-
// getInstance: ${workerCode} \n
|
148
|
-
// }`
|
149
|
-
// );
|
134
|
+
}`);
|
150
135
|
});
|
151
136
|
}
|
@@ -13,10 +13,6 @@ var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-we
|
|
13
13
|
|
14
14
|
var _common = require("../common");
|
15
15
|
|
16
|
-
var _utils = require("../utils");
|
17
|
-
|
18
|
-
var _CustomScriptLoadingStrategyPlugin = _interopRequireDefault(require("../plugins/CustomScriptLoadingStrategyPlugin"));
|
19
|
-
|
20
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
17
|
|
22
18
|
const defaultHTMLMiniFyOption = {
|
@@ -30,47 +26,6 @@ const defaultHTMLMiniFyOption = {
|
|
30
26
|
removeStyleLinkTypeAttributes: true,
|
31
27
|
useShortDoctype: true
|
32
28
|
};
|
33
|
-
const defaultScriptLoadingStrategy = 'defer';
|
34
|
-
const allowedScriptLoadingStrategies = ['blocking', 'defer', 'async', 'module'];
|
35
|
-
|
36
|
-
function isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey) {
|
37
|
-
return allowedScriptLoadingStrategies.includes(scriptLoadingStategey);
|
38
|
-
}
|
39
|
-
|
40
|
-
function getScriptLoadingStrategyForStringType(scriptLoadingStategey) {
|
41
|
-
if (isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey)) {
|
42
|
-
return scriptLoadingStategey;
|
43
|
-
}
|
44
|
-
|
45
|
-
return defaultScriptLoadingStrategy;
|
46
|
-
}
|
47
|
-
|
48
|
-
function getScriptLoadingStrategyForObject(scriptLoadingStategey) {
|
49
|
-
if (Object.keys(scriptLoadingStategey).length === 0) {
|
50
|
-
return defaultScriptLoadingStrategy;
|
51
|
-
}
|
52
|
-
|
53
|
-
const isAllowedScriptLoadingStrategy = Object.keys(scriptLoadingStategey).every(key => isAllowedScriptLoadingStrategyUsed(key));
|
54
|
-
|
55
|
-
if (isAllowedScriptLoadingStrategy) {
|
56
|
-
return Object.assign({}, scriptLoadingStategey);
|
57
|
-
}
|
58
|
-
|
59
|
-
console.warn('un supported script loading strategy used', scriptLoadingStategey);
|
60
|
-
return defaultScriptLoadingStrategy;
|
61
|
-
}
|
62
|
-
|
63
|
-
function getScriptLoadingStrategy(scriptLoadingStategey) {
|
64
|
-
if ((0, _utils.getTypeOf)(scriptLoadingStategey) === 'string') {
|
65
|
-
return getScriptLoadingStrategyForStringType(scriptLoadingStategey);
|
66
|
-
}
|
67
|
-
|
68
|
-
if ((0, _utils.getTypeOf)(scriptLoadingStategey) === 'object') {
|
69
|
-
return getScriptLoadingStrategyForObject(scriptLoadingStategey);
|
70
|
-
}
|
71
|
-
|
72
|
-
return 'defer';
|
73
|
-
}
|
74
29
|
|
75
30
|
function configHtmlWebpackPlugins(plugins, {
|
76
31
|
enableChunkHash = false,
|
@@ -78,8 +33,7 @@ function configHtmlWebpackPlugins(plugins, {
|
|
78
33
|
inject,
|
79
34
|
crossorigin,
|
80
35
|
hasEFC,
|
81
|
-
minify: minifyHtmlOptions = false
|
82
|
-
customScriptLoadingStrategey = {}
|
36
|
+
minify: minifyHtmlOptions = false
|
83
37
|
}) {
|
84
38
|
const optionsHtmlWebpack = {
|
85
39
|
chunksSortMode: 'none',
|
@@ -102,14 +56,4 @@ function configHtmlWebpackPlugins(plugins, {
|
|
102
56
|
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
103
57
|
crossorigin: 'anonymous'
|
104
58
|
}));
|
105
|
-
|
106
|
-
if (customScriptLoadingStrategey.enable) {
|
107
|
-
const currentScriptLoadingStrategy = getScriptLoadingStrategy(customScriptLoadingStrategey.options);
|
108
|
-
|
109
|
-
if ((0, _utils.getTypeOf)(currentScriptLoadingStrategy) === 'object') {
|
110
|
-
plugins.push(new _CustomScriptLoadingStrategyPlugin.default({
|
111
|
-
scriptLoadingStategey: currentScriptLoadingStrategy
|
112
|
-
}));
|
113
|
-
}
|
114
|
-
}
|
115
59
|
}
|
@@ -62,8 +62,7 @@ const getDevPlugins = (options, publicPath) => {
|
|
62
62
|
mode
|
63
63
|
},
|
64
64
|
htmlTemplate: {
|
65
|
-
inject
|
66
|
-
customScriptLoadingStrategey
|
65
|
+
inject
|
67
66
|
},
|
68
67
|
crossorigin
|
69
68
|
},
|
@@ -169,8 +168,7 @@ const getDevPlugins = (options, publicPath) => {
|
|
169
168
|
minify: false,
|
170
169
|
inject,
|
171
170
|
crossorigin,
|
172
|
-
hasEFC
|
173
|
-
customScriptLoadingStrategey
|
171
|
+
hasEFC
|
174
172
|
});
|
175
173
|
|
176
174
|
if (hasEFC) {
|
@@ -80,8 +80,7 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
80
80
|
} = options.app;
|
81
81
|
const {
|
82
82
|
inject,
|
83
|
-
minify: minifyHtmlOptions
|
84
|
-
customScriptLoadingStrategey
|
83
|
+
minify: minifyHtmlOptions
|
85
84
|
} = htmlTemplate;
|
86
85
|
const {
|
87
86
|
i18n
|
@@ -179,7 +178,6 @@ const getProdPlugins = (options, publicPath = '') => {
|
|
179
178
|
folder,
|
180
179
|
inject,
|
181
180
|
minify: minifyHtmlOptions,
|
182
|
-
customScriptLoadingStrategey,
|
183
181
|
crossorigin,
|
184
182
|
hasEFC
|
185
183
|
});
|
@@ -18,10 +18,10 @@ class EventsHandlingPlugin {
|
|
18
18
|
fn: compilation => {
|
19
19
|
compilation.mainTemplate.hooks.requireEnsure.tap('CustomAttributePlugin', source => {
|
20
20
|
// const str = attributeSetTemplate(cssAttributes, 'linkTag');
|
21
|
-
const sourceStr = source.replace('linkTag.onerror = function(event) {', 'linkTag.onerror = function(event) { linkTag.onerror = linkTag.onload = null
|
21
|
+
const sourceStr = source.replace('linkTag.onerror = function(event) {', 'linkTag.onerror = function(event) { linkTag.onerror = linkTag.onload = null');
|
22
22
|
const replacedSourceStr = sourceStr.replace('linkTag.onload = resolve', `linkTag.onload = () => {
|
23
|
-
linkTag.onerror = linkTag.onload = null;
|
24
23
|
resolve();
|
24
|
+
linkTag.onerror = linkTag.onload = null
|
25
25
|
};`);
|
26
26
|
return replacedSourceStr;
|
27
27
|
});
|
@@ -229,8 +229,8 @@ class I18nDownlodLogic {
|
|
229
229
|
}
|
230
230
|
var scriptTag = document.createElement("script");
|
231
231
|
scriptTag.onload = () => {
|
232
|
-
scriptTag.onerror = scriptTag.onload = null;
|
233
232
|
resolve();
|
233
|
+
scriptTag.onerror = scriptTag.onload = null;
|
234
234
|
};
|
235
235
|
scriptTag.onerror = function(event) {
|
236
236
|
scriptTag.onerror = scriptTag.onload = null;
|
package/lib/schemas/index.js
CHANGED
@@ -125,6 +125,7 @@ var _default = {
|
|
125
125
|
cssDirStatement: null
|
126
126
|
},
|
127
127
|
app: {
|
128
|
+
alias: {},
|
128
129
|
moduleResolvePath: {
|
129
130
|
value: '@zohodesk/client_packages_group',
|
130
131
|
cli: 'module_resolve_path'
|
@@ -322,11 +323,7 @@ var _default = {
|
|
322
323
|
},
|
323
324
|
htmlTemplate: {
|
324
325
|
minify: null,
|
325
|
-
inject: true
|
326
|
-
customScriptLoadingStrategey: {
|
327
|
-
enable: false,
|
328
|
-
options: null
|
329
|
-
}
|
326
|
+
inject: true
|
330
327
|
},
|
331
328
|
removePropTypes: false,
|
332
329
|
customChunksBaseConfig: null,
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _getOptions = _interopRequireDefault(require("./getOptions"));
|
4
|
+
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
|
+
|
7
|
+
const options = (0, _getOptions.default)();
|
8
|
+
const alias = options.app.alias;
|
9
|
+
|
10
|
+
module.exports = () => ({
|
11
|
+
visitor: {
|
12
|
+
ImportDeclaration(path) {
|
13
|
+
const source = path.node.source.value;
|
14
|
+
const aliasName = Object.keys(alias);
|
15
|
+
aliasName.forEach(name => {
|
16
|
+
if (source.includes(name)) {
|
17
|
+
path.node.source.value = source.replace(name, alias[name]);
|
18
|
+
}
|
19
|
+
});
|
20
|
+
}
|
21
|
+
|
22
|
+
}
|
23
|
+
});
|
package/lib/utils/index.js
CHANGED
@@ -167,20 +167,6 @@ var _getComponents = _interopRequireDefault(require("./getComponents"));
|
|
167
167
|
|
168
168
|
var _ssTestHack = _interopRequireDefault(require("./ssTestHack"));
|
169
169
|
|
170
|
-
var _typeCheck = require("./typeCheck");
|
171
|
-
|
172
|
-
Object.keys(_typeCheck).forEach(function (key) {
|
173
|
-
if (key === "default" || key === "__esModule") return;
|
174
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
175
|
-
if (key in exports && exports[key] === _typeCheck[key]) return;
|
176
|
-
Object.defineProperty(exports, key, {
|
177
|
-
enumerable: true,
|
178
|
-
get: function () {
|
179
|
-
return _typeCheck[key];
|
180
|
-
}
|
181
|
-
});
|
182
|
-
});
|
183
|
-
|
184
170
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
185
171
|
|
186
172
|
// eslint-disable-next-line no-duplicate-imports
|
package/npm-shrinkwrap.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zohodesk/react-cli",
|
3
|
-
"version": "1.1.22
|
3
|
+
"version": "1.1.22",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "@zohodesk/react-cli",
|
9
|
-
"version": "1.1.22
|
9
|
+
"version": "1.1.22",
|
10
10
|
"license": "ISC",
|
11
11
|
"dependencies": {
|
12
12
|
"@babel/cli": "7.10.5",
|
package/package.json
CHANGED
@@ -1,108 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
9
|
-
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
-
|
12
|
-
const pluginName = 'CustomScriptLoadingStrategyPlugin';
|
13
|
-
|
14
|
-
class CustomScriptLoadingStrategyPlugin {
|
15
|
-
constructor({
|
16
|
-
scriptLoadingStategey
|
17
|
-
} = {}) {
|
18
|
-
this.scriptLoadingStrategy = scriptLoadingStategey;
|
19
|
-
}
|
20
|
-
|
21
|
-
getFileNameFromTagSrc(src) {
|
22
|
-
const fileNameArr = src.split('/');
|
23
|
-
return fileNameArr[fileNameArr.length - 1];
|
24
|
-
}
|
25
|
-
|
26
|
-
addAttributestToTag(tag, attributes) {
|
27
|
-
tag.attributes = Object.assign({}, tag.attributes, attributes);
|
28
|
-
}
|
29
|
-
|
30
|
-
matchFileName(tag, fileName) {
|
31
|
-
return fileName.test(this.getFileNameFromTagSrc(tag.attributes.src));
|
32
|
-
}
|
33
|
-
|
34
|
-
blockingStrategy(tag) {
|
35
|
-
delete tag.attributes.defer;
|
36
|
-
delete tag.attributes.async;
|
37
|
-
}
|
38
|
-
|
39
|
-
deferStrategy(tag) {
|
40
|
-
delete tag.attributes.async;
|
41
|
-
}
|
42
|
-
|
43
|
-
asyncStrategy(tag) {
|
44
|
-
delete tag.attributes.defer;
|
45
|
-
}
|
46
|
-
|
47
|
-
moduleStrategy(tag) {
|
48
|
-
this.deferStrategy(tag);
|
49
|
-
}
|
50
|
-
|
51
|
-
matchStrategy(scriptLoadingStrategy, tag) {
|
52
|
-
if (scriptLoadingStrategy === 'blocking') {
|
53
|
-
this.blockingStrategy(tag);
|
54
|
-
}
|
55
|
-
|
56
|
-
if (scriptLoadingStrategy === 'defer') {
|
57
|
-
this.deferStrategy(tag);
|
58
|
-
}
|
59
|
-
|
60
|
-
if (scriptLoadingStrategy === 'async') {
|
61
|
-
this.asyncStrategy(tag);
|
62
|
-
}
|
63
|
-
|
64
|
-
if (scriptLoadingStrategy === 'module') {
|
65
|
-
this.moduleStrategy(tag);
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
matchAndApplyCustomLoadingStrategyToScripts(tags) {
|
70
|
-
Object.keys(this.scriptLoadingStrategy).forEach(scriptLoadingStrategy => {
|
71
|
-
const filesToMatch = this.scriptLoadingStrategy[scriptLoadingStrategy];
|
72
|
-
tags.forEach(tag => {
|
73
|
-
if (tag.attributes.src) {
|
74
|
-
const isFileMatch = filesToMatch.some(fileName => this.matchFileName(tag, fileName));
|
75
|
-
|
76
|
-
if (isFileMatch) {
|
77
|
-
this.matchStrategy(scriptLoadingStrategy, tag);
|
78
|
-
this.addAttributestToTag(tag, {
|
79
|
-
[scriptLoadingStrategy]: true
|
80
|
-
});
|
81
|
-
}
|
82
|
-
} // filesToMatch.forEach(fileName => {
|
83
|
-
// if (!this.matchFileName(tag, fileName)) {
|
84
|
-
// return;
|
85
|
-
// }
|
86
|
-
// this.matchStrategy(scriptLoadingStrategy, tag);
|
87
|
-
// this.addAttributestToTag(tag, fileName, {
|
88
|
-
// [scriptLoadingStrategy]: true
|
89
|
-
// });
|
90
|
-
// });
|
91
|
-
|
92
|
-
});
|
93
|
-
});
|
94
|
-
}
|
95
|
-
|
96
|
-
apply(compiler) {
|
97
|
-
compiler.hooks.compilation.tap(pluginName, compilation => {
|
98
|
-
_htmlWebpackPlugin.default.getHooks(compilation).alterAssetTagGroups.tapAsync(pluginName, (data, callback) => {
|
99
|
-
const tags = [...data.bodyTags, ...data.headTags];
|
100
|
-
this.matchAndApplyCustomLoadingStrategyToScripts(tags);
|
101
|
-
callback(null, data);
|
102
|
-
});
|
103
|
-
});
|
104
|
-
}
|
105
|
-
|
106
|
-
}
|
107
|
-
|
108
|
-
exports.default = CustomScriptLoadingStrategyPlugin;
|
package/lib/utils/typeCheck.js
DELETED