@zohodesk/react-cli 0.0.1-exp.176.4 → 0.0.1-exp.178.2
Sign up to get free protection for your applications and to get access to all the features.
- package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
- package/Changelog.md +1019 -0
- package/README.md +89 -11
- package/docs/DevServerPort.md +39 -0
- package/docs/VariableConversion.md +22 -8
- package/lib/common/splitChunks.js +1 -34
- package/lib/configs/resolvers.js +40 -0
- package/lib/configs/webpack.dev.config.js +4 -11
- package/lib/configs/webpack.docs.config.js +4 -11
- package/lib/configs/webpack.impact.config.js +5 -7
- package/lib/configs/webpack.prod.config.js +9 -13
- package/lib/constants.js +31 -0
- package/lib/loaderUtils/configsAssetsLoaders.js +2 -2
- package/lib/plugins/VariableConversionCollector.js +154 -54
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +4 -2
- package/lib/postcss-plugins/variableModificationPlugin/index.js +2 -1
- package/lib/schemas/index.js +8 -0
- package/lib/servers/docsServerCore.js +13 -12
- package/lib/servers/httpsOptions.js +40 -9
- package/lib/servers/nowatchserver.js +12 -11
- package/lib/servers/server.js +23 -20
- package/lib/utils/cssURLReplacer.js +30 -43
- package/lib/utils/getFileType.js +49 -0
- package/lib/utils/getOptions.js +13 -13
- package/package.json +8 -33
- package/postpublish.js +6 -4
- package/cert/Tsicsezwild-22-23.crt +0 -37
- package/cert/Tsicsezwild-22-23.key +0 -27
package/README.md
CHANGED
@@ -2,22 +2,104 @@
|
|
2
2
|
|
3
3
|
A CLI tool for build modern web application and libraries
|
4
4
|
|
5
|
-
#
|
5
|
+
# Installation
|
6
6
|
|
7
|
-
|
7
|
+
Below Steps:-
|
8
|
+
|
9
|
+
> `npm i -g @zohodesk/react-cli`
|
10
|
+
|
11
|
+
# Usage
|
12
|
+
|
13
|
+
## Step 1
|
14
|
+
|
15
|
+
> `mkdir <your-project-folder> && cd mkdir <your-project-folder>`
|
16
|
+
|
17
|
+
## Step 2
|
18
|
+
|
19
|
+
- create `package.json` file
|
20
|
+
- add this to your `package.json`
|
21
|
+
|
22
|
+
```json
|
23
|
+
{
|
24
|
+
"scripts": {
|
25
|
+
"start": "react-cli start",
|
26
|
+
"build": "react-cli build"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
```
|
30
|
+
|
31
|
+
## Step 3
|
32
|
+
|
33
|
+
- create below files
|
34
|
+
- `src/index.js`
|
35
|
+
- `src/index.html`
|
36
|
+
|
37
|
+
## Step 4
|
38
|
+
|
39
|
+
Now to run app
|
40
|
+
|
41
|
+
> `npm run start`
|
42
|
+
|
43
|
+
---
|
44
|
+
|
45
|
+
# Change Logs
|
46
|
+
|
47
|
+
|
48
|
+
# 0.0.1-exp.178.2
|
49
|
+
|
50
|
+
**Changes:**
|
51
|
+
|
52
|
+
- File support added for `.webm` for `docs`, `dev` and `prod` mode
|
53
|
+
|
54
|
+
# 0.0.1-exp.178.1
|
55
|
+
|
56
|
+
**Breaking Changes:**
|
57
|
+
|
58
|
+
- We have remove ssl certificate for security reasons.
|
59
|
+
So default https server won't run.
|
60
|
+
In order to make it work as before you need to specify two things
|
61
|
+
1. install `@zohodesk-private/client_dev_cert`
|
62
|
+
2. `react-cli.app.server.httpsCerts` option example `"httpsCerts": "@zohodesk-private/client_dev_cert"`
|
63
|
+
unless configaration are proper this may break `start` , `docs` , `nowatchstart`.
|
64
|
+
So Please be carefull when you update this version or above without proper configaration.
|
65
|
+
|
66
|
+
# 0.0.1-beta.177
|
67
|
+
|
68
|
+
**Changes:**
|
69
|
+
|
70
|
+
- We have added extra new Error option `MULTIPLE_OCCURANCES` support for **convert px to custom variables**.
|
71
|
+
- In case css --variables are not assigned an error will be thrown and logged in `.cli/logs/unassignedVariables.log`. The unassigned variables can be manually assigned in `variableMapping.json` through two keys :
|
72
|
+
- `changes` : for the variables that have to be converted, manual values can be added ( eg. "--wms_height": "height" )
|
73
|
+
- `ignore` : for the variables that do not have to be considered, they can be added as keys with some value in `ignore` key (eg. "--gc_widget_video_bg": "undefined"). These values will be ignored.
|
74
|
+
- strict mode can be enabled for checking --variables in `cssVariableReplacementOptions.strictMode`
|
75
|
+
For more information and reference, refer to `[details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/VariableConversion.md)
|
76
|
+
|
77
|
+
- and this version has same as `0.0.1-exp.176.12`, `0.0.1-exp.176.11`
|
78
|
+
|
79
|
+
# 0.0.1-exp.176.12
|
80
|
+
|
81
|
+
**Changes:**
|
82
|
+
|
83
|
+
- Earlier versions of react-cli, we have been putting video files under images folder in build output, now, we have moved the video files under videos folder in build output.
|
84
|
+
|
85
|
+
# 0.0.1-exp.176.11
|
86
|
+
|
87
|
+
**Issue Fix:**
|
88
|
+
|
89
|
+
- When we use `react-cli.app.publicPaths.callback` this option and video files import, in place of publicPath url, **null** was there instead of file type `video` issue fixed.
|
8
90
|
|
9
91
|
# 0.0.1-beta.176
|
10
92
|
|
11
93
|
**Features:**
|
12
94
|
|
13
95
|
- we have added feature to **increase Selector weight** for all css classes in your project during build time.
|
14
|
-
To enable this feature you have to `react-cli.app.plugins.selectorWeight`
|
96
|
+
To enable this feature you have to set `react-cli.app.plugins.selectorWeight` as `true` in **package.json**.
|
15
97
|
For more [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/SelectorWeight.md)
|
16
98
|
- Updates to variable replacement are given :
|
17
99
|
- css variables with -- are now supported due to the webpack plugin `VariableConversionCollector` that is generated for the same.
|
18
100
|
- `DECIMAL_CHECK`, `DECIMAL_REJECT` are two new errors supported.
|
19
101
|
- support for text-indent, clip, flex, flex-basis, row-gap, column-gap, gap properties are now given.
|
20
|
-
For
|
102
|
+
For more information and reference, refer to `[details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/VariableConversion.md)
|
21
103
|
|
22
104
|
# 0.0.1-beta.175
|
23
105
|
|
@@ -29,13 +111,9 @@ React and React DOM version 18 and splitchunks config
|
|
29
111
|
|
30
112
|
- `minifiy` option supported for minimize index.html file in during build time. You can use this option as "react-cli.app.htmlTemplate.minify" the options are same as https://github.com/jantimon/html-webpack-plugin#minification
|
31
113
|
|
32
|
-
|
33
|
-
|
34
|
-
Splitchunks config test
|
35
|
-
|
36
|
-
# 0.0.1-beta.174
|
114
|
+
> `npm i -g @zohodesk/react-cli`
|
37
115
|
|
38
|
-
|
116
|
+
add in you project `package.json`
|
39
117
|
|
40
118
|
**Issue Fix:-**
|
41
119
|
|
@@ -60,7 +138,7 @@ cli has been updated to fix compose issue faced when classname:hover exists and
|
|
60
138
|
|
61
139
|
Conversion for css Variables from Variables to px in Supportapp completed (`variableIgnore.js` && `pxParserPostcss.js` to be referred to), and px to custom variables through the new `variableModificationPlugin`. Error Log generation can also be converted on enabling
|
62
140
|
|
63
|
-
For an more information and reference, refer to `[details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/
|
141
|
+
For an more information and reference, refer to `[details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/VariableConversion.md)
|
64
142
|
|
65
143
|
# 0.0.1-beta.172
|
66
144
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Dev server port
|
2
|
+
|
3
|
+
in react-cli dev server ports are below
|
4
|
+
|
5
|
+
In summary
|
6
|
+
for https port will be same as given
|
7
|
+
for http2 port will be same as given + 1
|
8
|
+
for http port will be same as given + 2
|
9
|
+
|
10
|
+
with https certificate `react-cli.app.sercer.httpsCerts` given value
|
11
|
+
in default port `react-cli.app.server.port` is 9090
|
12
|
+
|
13
|
+
| Protocal | Port |
|
14
|
+
| :------: | :--: |
|
15
|
+
| HTTPS | 9090 |
|
16
|
+
| HTTP2 | 9091 |
|
17
|
+
| HTTP | 9092 |
|
18
|
+
|
19
|
+
in custom port `react-cli.app.server.port` is 5050
|
20
|
+
|
21
|
+
| Protocal | Port |
|
22
|
+
| :------: | :--: |
|
23
|
+
| HTTPS | 5050 |
|
24
|
+
| HTTP2 | 5051 |
|
25
|
+
| HTTP | 5052 |
|
26
|
+
|
27
|
+
with out https certificate
|
28
|
+
|
29
|
+
in custom port `react-cli.app.server.port` is 9090
|
30
|
+
|
31
|
+
| Protocal | Port |
|
32
|
+
| :------: | :--: |
|
33
|
+
| HTTP | 9092 |
|
34
|
+
|
35
|
+
in custom port `react-cli.app.server.port` is 5050
|
36
|
+
|
37
|
+
| Protocal | Port |
|
38
|
+
| :------: | :--: |
|
39
|
+
| HTTP | 5052 |
|
@@ -5,18 +5,27 @@
|
|
5
5
|
Conversion for Variables from Variables to px in Supportapp completed (`variableIgnore.js` && `pxParserPostcss.js` to be referred to), and px to custom variables through the new `variableModificationPlugin`. Error Log generation can also be converted on enabling
|
6
6
|
|
7
7
|
**Features:**
|
8
|
-
|
8
|
+
# Features below are added form `0.0.1-beta.173`
|
9
9
|
1. variables are converted from px to custom variables ( options are consumed from `cssVariableReplacementOptions.json` present in source folder )
|
10
10
|
2. To enable the error log generation `errorLog` is to be made `true` in `cssVariableReplacementOptions.json` ( it will take a little longer than usual build time )
|
11
11
|
3. To enable the console display of errors that are generated, `errorInConsole` is to be made `true` in `cssVariableReplacementOptions.json`
|
12
12
|
4. To enable specific errors in the error log generation / error display on console, `DECLARATION_IGNORED`(for ignoring that particular line / declaration),`UNIT_ERROR` (when the Unit doesnt match the available units for the property),`RANGE_ERROR` (when the value does not fall within the range that is given for the property), `VARIABLE_PRESENT`(whether the value supposed to be in px for conversion sake is not converted from var() to px or if it's properly converted to px for conversion from px to var through our plugin) are to be individually made `true` in `cssVariableReplacementOptions.json`
|
13
13
|
|
14
|
-
|
14
|
+
# Features below are added form `0.0.1-beta.176`
|
15
15
|
|
16
16
|
* variables with -- are now supported due to the webpack plugin `VariableConversionCollector` that is generated for the same.
|
17
17
|
* `DECIMAL_CHECK`, `DECIMAL_REJECT` are two new errors supported.
|
18
18
|
* support for text-indent, clip, flex, flex-basis, row-gap, column-gap, gap properties are now given.
|
19
19
|
|
20
|
+
# Features below are added form `0.0.1-beta.177`
|
21
|
+
|
22
|
+
* new Error `MULTIPLE_OCCURANCES` supported.
|
23
|
+
* In case css --variables are not assigned an error will be thrown and logged in `.cli/logs/unassignedVariables.log`. The unassigned variables can be manually assigned in `variableMapping.json` through two keys :
|
24
|
+
* `changes` : for the variables that have to be converted, manual values can be added ( eg. "--wms_height": "height" )
|
25
|
+
* `ignore` : for the variables that do not have to be considered, they can be added as keys with some value in `ignore` key (eg. "--gc_widget_video_bg": "undefined"). These values will be ignored.
|
26
|
+
* strict mode can be enabled for checking --variables in `cssVariableReplacementOptions.strictMode`
|
27
|
+
|
28
|
+
For more information and reference, refer to `[details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/VariableConversion.md)
|
20
29
|
|
21
30
|
<!-- file paths :
|
22
31
|
|
@@ -77,10 +86,13 @@ jsapps\supportapp\plugins\variableIgnore.js ( adding variable:ignore comment to
|
|
77
86
|
"errorLog": false,
|
78
87
|
"errorInConsole": false,
|
79
88
|
"errorsAllowed":{
|
80
|
-
"DECLARATION_IGNORED"
|
81
|
-
"UNIT_ERROR"
|
82
|
-
"
|
83
|
-
"
|
89
|
+
"DECLARATION_IGNORED": true,
|
90
|
+
"UNIT_ERROR": true,
|
91
|
+
"DECIMAL_CHECK": true,
|
92
|
+
"DECIMAL_REJECT": true,
|
93
|
+
"RANGE_ERROR": true,
|
94
|
+
"VARIABLE_PRESENT": true,
|
95
|
+
"MULTIPLE_OCCURANCES": false
|
84
96
|
},
|
85
97
|
"settings": {
|
86
98
|
"font-size": {
|
@@ -701,10 +713,12 @@ Consider the below mentioned :
|
|
701
713
|
=> `DECLARATION_IGNORED` : Lines that succeed the /*Variable:Ignore*/ comment.
|
702
714
|
=> `UNIT_ERROR` : the units that are not present in the corresponding property's `allowed` array are used.
|
703
715
|
=> `RANGE_ERROR` : numerical values that are not present within the range of the corresponding property's `range` is used.
|
704
|
-
=> `DECIMAL_CHECK` : Decimal values containing . will be shown
|
705
|
-
=> `DECIMAL_REJECT` : Decimal values such as .em which are to be rejected are shown
|
716
|
+
=> `DECIMAL_CHECK` : Decimal values containing . will be shown ( flex : 1.3 )
|
717
|
+
=> `DECIMAL_REJECT` : Decimal values such as .em which are to be rejected are shown ( font-size : 12.5px )
|
706
718
|
=> `VARIABLE_PRESENT` : conversion to px (Step 2) wasn't done properly and hence there are residues that contain `var` in it are found.
|
719
|
+
=> `MULTIPLE_OCCURANCES` : using --vars in multiple places ( using --zd_avatar_padding_left in left and right ), which results in confusion during conversion
|
707
720
|
|
721
|
+
. --variables can be checked and debugged when the `strictMode` flag is enabled in `cssVariableReplacementOptions.json` file. The variables unassigned will be logged in the `unassignedVariable.log`. The manual assigning of all keys present will be split into `ignore` and `changes` for ignoring the variable and changing the variable respectively.
|
708
722
|
|
709
723
|
* First two conversions are to be done manually by the use of the commands, `npm run variable:addignore` and `npm run variable:convert`
|
710
724
|
* Final conversion is done by react-cli on compilation of the source folder `npm run start --app:port=**** --app:domain=****`
|
@@ -61,30 +61,6 @@ let defaultChunks = {
|
|
61
61
|
test: isVendor,
|
62
62
|
// priority: 19,
|
63
63
|
priority: -10
|
64
|
-
},
|
65
|
-
zdvendorsAsync: {
|
66
|
-
chunks: 'async',
|
67
|
-
minChunks: 2,
|
68
|
-
automaticNamePrefix: 'zdvendors-async',
|
69
|
-
test: module => {
|
70
|
-
let {
|
71
|
-
userRequest
|
72
|
-
} = module;
|
73
|
-
return userRequest && userRequest.endsWith('.css') === false && /[\\/]node_modules[\\/]((@zohodesk).*)[\\/]/.test(userRequest);
|
74
|
-
},
|
75
|
-
priority: -10
|
76
|
-
},
|
77
|
-
commons: {
|
78
|
-
chunks: 'all',
|
79
|
-
minChunks: 2,
|
80
|
-
priority: -20,
|
81
|
-
reuseExistingChunk: true,
|
82
|
-
test: module => {
|
83
|
-
let {
|
84
|
-
userRequest
|
85
|
-
} = module;
|
86
|
-
return userRequest && userRequest.endsWith('.css') === false;
|
87
|
-
}
|
88
64
|
}
|
89
65
|
};
|
90
66
|
let customChunksConfig = {};
|
@@ -141,16 +117,7 @@ customChunks.map((obj, index) => ({
|
|
141
117
|
return customChunksConfig[name] = obj;
|
142
118
|
});
|
143
119
|
var _default = {
|
144
|
-
|
145
|
-
// minSize: 30,
|
146
|
-
minSize: 20000,
|
147
|
-
minChunks: 1,
|
148
|
-
// maxAsyncRequests: 5,
|
149
|
-
// maxInitialRequests: 3,
|
150
|
-
// minChunks: 1,
|
151
|
-
maxAsyncRequests: 5,
|
152
|
-
maxInitialRequests: 3,
|
153
|
-
enforceSizeThreshold: 50000,
|
120
|
+
minSize: 12000,
|
154
121
|
cacheGroups: Object.assign({
|
155
122
|
default: false,
|
156
123
|
vendors: false
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.loaderResolver = loaderResolver;
|
7
|
+
exports.moduleResolver = moduleResolver;
|
8
|
+
|
9
|
+
var _constants = require("../constants");
|
10
|
+
|
11
|
+
var _libAlias = require("./libAlias");
|
12
|
+
|
13
|
+
var _client_packages_group = require("@zohodesk/client_packages_group");
|
14
|
+
|
15
|
+
function moduleResolver(options) {
|
16
|
+
const {
|
17
|
+
moduleResolvePath,
|
18
|
+
disableES5Transpile
|
19
|
+
} = options.app;
|
20
|
+
const nodeModulesPath = moduleResolvePath ? require(require.resolve(moduleResolvePath, {
|
21
|
+
paths: [options.cwd]
|
22
|
+
})).nodeModulesPath : _client_packages_group.nodeModulesPath; // const {unstableDepsInverse} = options;
|
23
|
+
|
24
|
+
return {
|
25
|
+
modules: [nodeModulesPath, _constants.cliNodemodulesPath, 'node_modules'].filter(Boolean),
|
26
|
+
alias: disableES5Transpile ? _libAlias.libAlias : {} // alias: { ...libAlias, ...clientDependenies }
|
27
|
+
|
28
|
+
};
|
29
|
+
}
|
30
|
+
|
31
|
+
function loaderResolver(options) {
|
32
|
+
// const unstableDepsInverse = false;
|
33
|
+
const {
|
34
|
+
unstableDepsInverse
|
35
|
+
} = options;
|
36
|
+
return {
|
37
|
+
modules: unstableDepsInverse ? ['node_modules', _constants.cliNodemodulesPath] : [_constants.cliNodemodulesPath, 'node_modules'] // alias: libAlias
|
38
|
+
|
39
|
+
};
|
40
|
+
}
|
@@ -10,15 +10,14 @@ var _pluginUtils = require("../pluginUtils");
|
|
10
10
|
|
11
11
|
var _loaderUtils = require("../loaderUtils");
|
12
12
|
|
13
|
-
var _libAlias = require("./libAlias");
|
14
|
-
|
15
13
|
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
16
14
|
|
15
|
+
var _resolvers = require("./resolvers");
|
16
|
+
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
18
|
|
19
19
|
const options = (0, _utils.getOptions)();
|
20
20
|
const {
|
21
|
-
unstableDepsInverse,
|
22
21
|
app: {
|
23
22
|
folder,
|
24
23
|
context,
|
@@ -37,7 +36,6 @@ const {
|
|
37
36
|
cssHashSelectors,
|
38
37
|
classNamePrefix,
|
39
38
|
selectorReplace,
|
40
|
-
disableES5Transpile,
|
41
39
|
devConsoleExculde,
|
42
40
|
sourcemap,
|
43
41
|
crossorigin
|
@@ -147,11 +145,6 @@ module.exports = {
|
|
147
145
|
externals: {
|
148
146
|
ZC: '$ZC'
|
149
147
|
},
|
150
|
-
resolve:
|
151
|
-
|
152
|
-
alias: disableES5Transpile ? _libAlias.libAlias : {}
|
153
|
-
},
|
154
|
-
resolveLoader: {
|
155
|
-
modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
156
|
-
}
|
148
|
+
resolve: (0, _resolvers.moduleResolver)(options),
|
149
|
+
resolveLoader: (0, _resolvers.loaderResolver)(options)
|
157
150
|
};
|
@@ -8,18 +8,16 @@ var _pluginUtils = require("../pluginUtils");
|
|
8
8
|
|
9
9
|
var _loaderUtils = require("../loaderUtils");
|
10
10
|
|
11
|
-
var _libAlias = require("./libAlias");
|
12
|
-
|
13
11
|
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
14
12
|
|
13
|
+
var _resolvers = require("./resolvers");
|
14
|
+
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
16
|
|
17
17
|
const options = (0, _utils.getOptions)();
|
18
18
|
const {
|
19
|
-
unstableDepsInverse,
|
20
19
|
docs: {
|
21
20
|
componentFolder,
|
22
|
-
disableES5Transpile,
|
23
21
|
enableChunkHash,
|
24
22
|
cssUniqueness,
|
25
23
|
plugins,
|
@@ -116,11 +114,6 @@ module.exports = isSSTest => ({
|
|
116
114
|
externals: {
|
117
115
|
ZC: '$ZC'
|
118
116
|
},
|
119
|
-
resolve:
|
120
|
-
|
121
|
-
alias: disableES5Transpile ? _libAlias.libAlias : {}
|
122
|
-
},
|
123
|
-
resolveLoader: {
|
124
|
-
modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
125
|
-
}
|
117
|
+
resolve: (0, _resolvers.moduleResolver)(options),
|
118
|
+
resolveLoader: (0, _resolvers.loaderResolver)(options)
|
126
119
|
});
|
@@ -10,6 +10,8 @@ var _getLibraryImactPlugins = _interopRequireDefault(require("../pluginUtils/get
|
|
10
10
|
|
11
11
|
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
12
12
|
|
13
|
+
var _resolvers = require("./resolvers");
|
14
|
+
|
13
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
16
|
|
15
17
|
const options = (0, _utils.getOptions)();
|
@@ -39,6 +41,7 @@ module.exports = {
|
|
39
41
|
},
|
40
42
|
devtool: 'none',
|
41
43
|
mode: 'development',
|
44
|
+
stats: 'errors-only',
|
42
45
|
output: {
|
43
46
|
path: _path.default.join(appPath, 'build'),
|
44
47
|
filename: 'js/[name].js',
|
@@ -112,11 +115,6 @@ module.exports = {
|
|
112
115
|
externals: {
|
113
116
|
ZC: '$ZC'
|
114
117
|
},
|
115
|
-
resolve:
|
116
|
-
|
117
|
-
},
|
118
|
-
resolveLoader: {
|
119
|
-
modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
120
|
-
},
|
121
|
-
stats: 'errors-only'
|
118
|
+
resolve: (0, _resolvers.moduleResolver)(options),
|
119
|
+
resolveLoader: (0, _resolvers.loaderResolver)(options)
|
122
120
|
};
|
@@ -10,20 +10,18 @@ var _pluginUtils = require("../pluginUtils");
|
|
10
10
|
|
11
11
|
var _loaderUtils = require("../loaderUtils");
|
12
12
|
|
13
|
-
var _libAlias = require("./libAlias");
|
14
|
-
|
15
13
|
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
16
14
|
|
15
|
+
var _resolvers = require("./resolvers");
|
16
|
+
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
18
|
|
19
19
|
// import TerserPlugin from 'terser-webpack-plugin';
|
20
20
|
const options = (0, _utils.getOptions)();
|
21
|
-
|
22
|
-
unstableDepsInverse,
|
21
|
+
const {
|
23
22
|
app: {
|
24
23
|
folder,
|
25
24
|
context,
|
26
|
-
enableChunkHash,
|
27
25
|
outputFolder,
|
28
26
|
disableES5Transpile,
|
29
27
|
removeAttribute,
|
@@ -48,6 +46,9 @@ let {
|
|
48
46
|
crossorigin
|
49
47
|
}
|
50
48
|
} = options;
|
49
|
+
let {
|
50
|
+
enableChunkHash
|
51
|
+
} = options.app;
|
51
52
|
const appPath = process.cwd();
|
52
53
|
const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
|
53
54
|
enableChunkHash = !isDevelopment && enableChunkHash;
|
@@ -183,7 +184,7 @@ module.exports = {
|
|
183
184
|
fallback: _path.default.join(__dirname, '..', 'loaders', 'fileLoader.js')
|
184
185
|
}
|
185
186
|
}]
|
186
|
-
}, (0, _configsAssetsLoaders.configVideoLoaderObj)(enableChunkHash ? './
|
187
|
+
}, (0, _configsAssetsLoaders.configVideoLoaderObj)(enableChunkHash ? './videos/[name].[hash:20].[ext]' : './videos/[name].[ext]'), {
|
187
188
|
test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
|
188
189
|
use: [{
|
189
190
|
loader: 'url-loader',
|
@@ -233,11 +234,6 @@ module.exports = {
|
|
233
234
|
externals: {
|
234
235
|
ZC: '$ZC'
|
235
236
|
},
|
236
|
-
resolve:
|
237
|
-
|
238
|
-
alias: disableES5Transpile ? _libAlias.libAlias : {}
|
239
|
-
},
|
240
|
-
resolveLoader: {
|
241
|
-
modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
|
242
|
-
}
|
237
|
+
resolve: (0, _resolvers.moduleResolver)(options),
|
238
|
+
resolveLoader: (0, _resolvers.loaderResolver)(options)
|
243
239
|
};
|
package/lib/constants.js
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.cliRootPath = exports.cliNodemodulesPath = exports.appPath = exports.CONFIG_ROOT = exports.BASE_CONFIG_KEY = void 0;
|
7
|
+
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
const BASE_CONFIG_KEY = 'react-cli';
|
13
|
+
exports.BASE_CONFIG_KEY = BASE_CONFIG_KEY;
|
14
|
+
|
15
|
+
const cliRootPath = _path.default.resolve(__dirname, '..');
|
16
|
+
|
17
|
+
exports.cliRootPath = cliRootPath;
|
18
|
+
const CONFIG_ROOT = 'react-cli';
|
19
|
+
exports.CONFIG_ROOT = CONFIG_ROOT;
|
20
|
+
|
21
|
+
const cliNodemodulesPath = _path.default.resolve(cliRootPath, 'node_modules'); // export const babelrcPath = join(cliRootPath, '.babelrc');
|
22
|
+
|
23
|
+
|
24
|
+
exports.cliNodemodulesPath = cliNodemodulesPath;
|
25
|
+
const appPath = process.cwd(); // export const appInitialHTMLTemplatePath = path.join(
|
26
|
+
// process.cwd(),
|
27
|
+
// 'src',
|
28
|
+
// 'index.html'
|
29
|
+
// );
|
30
|
+
|
31
|
+
exports.appPath = appPath;
|
@@ -20,7 +20,7 @@ const ImageExtRegex = /\.jpe?g$|\.gif$|\.png$/;
|
|
20
20
|
const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
|
21
21
|
const SVGExtRegex = /\.svg$/;
|
22
22
|
const AudioExtRegex = /\.ogg$/;
|
23
|
-
const VidioExtRegex = /\.mp4$/;
|
23
|
+
const VidioExtRegex = /\.mp4|\.webm$/;
|
24
24
|
|
25
25
|
function createLoaderOptionQueryString(loaderName, nameTemplate, limit = 1000) {
|
26
26
|
return `${loaderName}?limit=${limit}&name=${nameTemplate}`;
|
@@ -57,7 +57,7 @@ function configAudioLoader(nameTemplate) {
|
|
57
57
|
function configVideoLoader(nameTemplate) {
|
58
58
|
return {
|
59
59
|
test: VidioExtRegex,
|
60
|
-
use: createLoaderOptionQueryString('url-loader', `./
|
60
|
+
use: createLoaderOptionQueryString('url-loader', `./videos/${nameTemplate}`, 1)
|
61
61
|
};
|
62
62
|
}
|
63
63
|
|