catalyst-core 0.0.1-beta.4 → 0.0.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +5 -5
- package/.eslintrc +0 -1
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/babel.config.json +1 -0
- package/bin/catalyst.js +1 -4
- package/caching.js +1 -16
- package/changelog.md +5 -19
- package/commitlint.config.js +11 -0
- package/index.js +1 -16
- package/logger.js +3 -92
- package/package.json +89 -87
- package/router/ClientRouter.js +2 -18
- package/router/ServerRouter.js +1 -19
- package/router.js +1 -16
- package/scripts/build.js +9 -41
- package/scripts/checkVersion.js +1 -5
- package/scripts/devBuild.js +9 -41
- package/scripts/devServe.js +4 -42
- package/scripts/loadEnvironmentVariables.js +4 -23
- package/scripts/loadScriptsBeforeServerStarts.js +5 -47
- package/scripts/resiterAliases.js +29 -0
- package/scripts/scriptUtils.js +2 -0
- package/scripts/serve.js +4 -42
- package/scripts/start.js +5 -34
- package/scripts/validator.js +1 -127
- package/server/expressServer.js +8 -49
- package/server/renderer/document/Body.js +6 -28
- package/server/renderer/document/Head.js +5 -39
- package/server/renderer/document/index.js +1 -27
- package/server/renderer/extract.js +6 -72
- package/server/renderer/handler.js +14 -237
- package/server/renderer/index.js +1 -12
- package/server/renderer/render.js +8 -71
- package/server/startServer.js +6 -66
- package/server/utils/userAgentUtil.js +3 -45
- package/server/utils/validator.js +1 -127
- package/webpack/babel-plugins/remove-client.plugin.js +3 -29
- package/webpack/babel-plugins/remove-ssr.plugin.js +3 -19
- package/webpack/babel.config.client.js +1 -24
- package/webpack/babel.config.ssr.js +1 -24
- package/webpack/base.babel.js +8 -175
- package/webpack/development.client.babel.js +4 -85
- package/webpack/production.client.babel.js +4 -78
- package/webpack/production.ssr.babel.js +4 -61
- package/webpack/scssParams.js +5 -47
- package/router/index.js +0 -32
- package/scripts/prepare.js +0 -19
- package/scripts/registerAliases.js +0 -30
- package/server/mainIndex.js +0 -65
- package/server/mainServer.js +0 -70
- package/server/renderer/userAgentUtil.js +0 -55
- package/server/utils/metaTags.js +0 -13
- package/webpack/babel.config.js +0 -20
- package/webpack/plugins/mime-types.js +0 -82
- package/webpack/plugins/route-manifest-copy.js +0 -122
- package/webpack/plugins/route-manifest-plugin.js +0 -122
- package/webpack/plugins/upload-assets-plugin.js +0 -181
|
@@ -1,127 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const pc = require("picocolors");
|
|
4
|
-
const handleError = e => {
|
|
5
|
-
console.log(pc.red("Failed to start server: "), e);
|
|
6
|
-
};
|
|
7
|
-
const validatePreInitServer = fn => {
|
|
8
|
-
try {
|
|
9
|
-
if (!fn) throw new Error("preServerInit named function should be defined in server/index.js");
|
|
10
|
-
if (typeof fn !== "function") throw new Error("preServerInit should be function present in server/index.js");
|
|
11
|
-
return true;
|
|
12
|
-
} catch (e) {
|
|
13
|
-
handleError(e);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const validateMiddleware = fn => {
|
|
17
|
-
try {
|
|
18
|
-
if (!fn) throw new Error("addMiddlewares named function not found in server/server.js");
|
|
19
|
-
if (typeof fn !== "function") throw new Error("addMiddlewares should be function present in server/server.js");
|
|
20
|
-
return true;
|
|
21
|
-
} catch (e) {
|
|
22
|
-
handleError(e);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const validateReducerFunction = fn => {
|
|
26
|
-
try {
|
|
27
|
-
if (!fn) throw new Error("reducer not found in src/js/containers/App/reducer");
|
|
28
|
-
if (typeof fn !== "function") throw new Error("reducer should present in src/js/containers/App/reducer");
|
|
29
|
-
return true;
|
|
30
|
-
} catch (e) {
|
|
31
|
-
handleError(e);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const validateConfigFile = obj => {
|
|
35
|
-
try {
|
|
36
|
-
if (!obj) throw new Error("config not found in config folder");
|
|
37
|
-
if (typeof obj !== "object") throw new Error("config object should be exported from config folder inside your project root directory");
|
|
38
|
-
if (typeof obj === "object") {
|
|
39
|
-
const requiredConfigKeys = {
|
|
40
|
-
NODE_SERVER_HOSTNAME: "",
|
|
41
|
-
NODE_SERVER_PORT: "",
|
|
42
|
-
WEBPACK_DEV_SERVER_HOSTNAME: "",
|
|
43
|
-
WEBPACK_DEV_SERVER_PORT: "",
|
|
44
|
-
BUILD_OUTPUT_PATH: "",
|
|
45
|
-
PUBLIC_STATIC_ASSET_PATH: "",
|
|
46
|
-
PUBLIC_STATIC_ASSET_URL: "",
|
|
47
|
-
CLIENT_ENV_VARIABLES: [],
|
|
48
|
-
ANALYZE_BUNDLE: ""
|
|
49
|
-
};
|
|
50
|
-
for (let key in requiredConfigKeys) {
|
|
51
|
-
if (!(key in obj)) throw new Error(`${key} key not found inside config.json`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return true;
|
|
55
|
-
} catch (e) {
|
|
56
|
-
handleError(e);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const validatePackageJson = obj => {
|
|
60
|
-
try {
|
|
61
|
-
if (!obj) throw new Error("package.json not found in the project");
|
|
62
|
-
if (typeof obj !== "object") throw new Error("package.json should be defined in project root directory");
|
|
63
|
-
return true;
|
|
64
|
-
} catch (e) {
|
|
65
|
-
handleError(e);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const validateModuleAlias = obj => {
|
|
69
|
-
try {
|
|
70
|
-
if (!obj) throw new Error("moduleAliases not found in package.json file present in root directory.");
|
|
71
|
-
if (typeof obj !== "object") throw new Error("moduleAliases named object should be exported from package.json");
|
|
72
|
-
if (typeof obj === "object") {
|
|
73
|
-
const requiredModuleAliases = {
|
|
74
|
-
"@api": "api.js",
|
|
75
|
-
"@containers": "src/js/containers",
|
|
76
|
-
"@server": "server",
|
|
77
|
-
"@config": "config",
|
|
78
|
-
"@css": "src/static/css",
|
|
79
|
-
"@routes": "src/js/routes/"
|
|
80
|
-
};
|
|
81
|
-
for (let key in requiredModuleAliases) {
|
|
82
|
-
if (!(key in obj)) throw new Error(`${key} module alias not defined inside package.json`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
} catch (e) {
|
|
87
|
-
handleError(e);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const validateConfigureStore = fn => {
|
|
91
|
-
try {
|
|
92
|
-
if (!fn) throw new Error("configureStore not found in file src/js/store/index.js");
|
|
93
|
-
if (typeof fn !== "function") throw new Error("configureStore should be function exported from src/js/store/index.js");
|
|
94
|
-
return true;
|
|
95
|
-
} catch (e) {
|
|
96
|
-
handleError(e);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const validateGetRoutes = fn => {
|
|
100
|
-
try {
|
|
101
|
-
if (!fn) throw new Error("getRoutes not found in file src/js/routes/utils.js");
|
|
102
|
-
if (typeof fn !== "function") throw new Error("getRoutes should be function exported from src/js/routers/index.js");
|
|
103
|
-
return true;
|
|
104
|
-
} catch (e) {
|
|
105
|
-
handleError(e);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const validateCustomDocument = fn => {
|
|
109
|
-
try {
|
|
110
|
-
if (!fn) throw new Error("document not found in file server/document.js");
|
|
111
|
-
if (typeof fn !== "function") throw new Error("document should be a react component exported from server/document.js");
|
|
112
|
-
return true;
|
|
113
|
-
} catch (e) {
|
|
114
|
-
handleError(e);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
module.exports = {
|
|
118
|
-
validateConfigFile,
|
|
119
|
-
validateConfigureStore,
|
|
120
|
-
validateCustomDocument,
|
|
121
|
-
validateGetRoutes,
|
|
122
|
-
validatePackageJson,
|
|
123
|
-
validateReducerFunction,
|
|
124
|
-
validateModuleAlias,
|
|
125
|
-
validatePreInitServer,
|
|
126
|
-
validateMiddleware
|
|
127
|
-
};
|
|
1
|
+
"use strict";const pc=require("picocolors");const handleError=e=>{console.log(pc.red("Failed to start server: "),e);};const validatePreInitServer=fn=>{try{if(!fn)throw new Error("preServerInit named function should be defined in server/index.js");if(typeof fn!=="function")throw new Error("preServerInit should be function present in server/index.js");return true;}catch(e){handleError(e);}};const validateMiddleware=fn=>{try{if(!fn)throw new Error("addMiddlewares named function not found in server/server.js");if(typeof fn!=="function")throw new Error("addMiddlewares should be function present in server/server.js");return true;}catch(e){handleError(e);}};const validateReducerFunction=fn=>{try{if(!fn)throw new Error("reducer not found in src/js/containers/App/reducer");if(typeof fn!=="function")throw new Error("reducer should present in src/js/containers/App/reducer");return true;}catch(e){handleError(e);}};const validateConfigFile=obj=>{try{if(!obj)throw new Error("config not found in config folder");if(typeof obj!=="object")throw new Error("config object should be exported from config folder inside your project root directory");if(typeof obj==="object"){const requiredConfigKeys={NODE_SERVER_HOSTNAME:"",NODE_SERVER_PORT:"",WEBPACK_DEV_SERVER_HOSTNAME:"",WEBPACK_DEV_SERVER_PORT:"",BUILD_OUTPUT_PATH:"",PUBLIC_STATIC_ASSET_PATH:"",PUBLIC_STATIC_ASSET_URL:"",CLIENT_ENV_VARIABLES:[],ANALYZE_BUNDLE:""};for(let key in requiredConfigKeys){if(!(key in obj))throw new Error(`${key} key not found inside config.json`);}}return true;}catch(e){handleError(e);}};const validatePackageJson=obj=>{try{if(!obj)throw new Error("package.json not found in the project");if(typeof obj!=="object")throw new Error("package.json should be defined in project root directory");return true;}catch(e){handleError(e);}};const validateModuleAlias=obj=>{try{if(!obj)throw new Error("moduleAliases not found in package.json file present in root directory.");if(typeof obj!=="object")throw new Error("moduleAliases named object should be exported from package.json");if(typeof obj==="object"){const requiredModuleAliases={"@api":"api.js","@containers":"src/js/containers","@server":"server","@config":"config","@css":"src/static/css","@routes":"src/js/routes/"};for(let key in requiredModuleAliases){if(!(key in obj))throw new Error(`${key} module alias not defined inside package.json`);}}return true;}catch(e){handleError(e);}};const validateConfigureStore=fn=>{try{if(!fn)throw new Error("configureStore not found in file src/js/store/index.js");if(typeof fn!=="function")throw new Error("configureStore should be function exported from src/js/store/index.js");return true;}catch(e){handleError(e);}};const validateGetRoutes=fn=>{try{if(!fn)throw new Error("getRoutes not found in file src/js/routes/utils.js");if(typeof fn!=="function")throw new Error("getRoutes should be function exported from src/js/routers/index.js");return true;}catch(e){handleError(e);}};const validateCustomDocument=fn=>{try{if(!fn)throw new Error("document not found in file server/document.js");if(typeof fn!=="function")throw new Error("document should be a react component exported from server/document.js");return true;}catch(e){handleError(e);}};module.exports={validateConfigFile,validateConfigureStore,validateCustomDocument,validateGetRoutes,validatePackageJson,validateReducerFunction,validateModuleAlias,validatePreInitServer,validateMiddleware};
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=_default;/**
|
|
8
2
|
* @description babel plugin used to remove unwanted code from the build.
|
|
9
3
|
* @return babel plugin object
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
name: "ast-transform",
|
|
14
|
-
// not required
|
|
15
|
-
visitor: {
|
|
16
|
-
ImportDefaultSpecifier(path) {
|
|
17
|
-
path.parentPath.parent.body = path.parentPath.parent.body.map(astStructure => {
|
|
18
|
-
if (astStructure.type === "VariableDeclaration") {
|
|
19
|
-
if (astStructure.declarations[0]?.init?.type === "ArrowFunctionExpression" && astStructure.declarations[0]?.init?.body?.body?.length > 0) {
|
|
20
|
-
astStructure.declarations[0].init.body.body = astStructure.declarations[0].init.body.body.filter(node => !(node?.type === "ExpressionStatement" && node?.expression?.callee?.name === "useEffect"));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
if (astStructure?.type === "FunctionDeclaration" && astStructure?.body?.body?.length > 0) {
|
|
24
|
-
astStructure.body.body = astStructure.body.body.filter(node => !(node?.type === "ExpressionStatement" && node?.expression?.callee?.name === "useEffect"));
|
|
25
|
-
}
|
|
26
|
-
return astStructure;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
4
|
+
*/function _default(){return{name:"ast-transform",// not required
|
|
5
|
+
visitor:{ImportDefaultSpecifier(path){path.parentPath.parent.body=path.parentPath.parent.body.map(astStructure=>{if(astStructure.type==="VariableDeclaration"){if(astStructure.declarations[0]?.init?.type==="ArrowFunctionExpression"&&astStructure.declarations[0]?.init?.body?.body?.length>0){astStructure.declarations[0].init.body.body=astStructure.declarations[0].init.body.body.filter(node=>!(node?.type==="ExpressionStatement"&&node?.expression?.callee?.name==="useEffect"));}}if(astStructure?.type==="FunctionDeclaration"&&astStructure?.body?.body?.length>0){astStructure.body.body=astStructure.body.body.filter(node=>!(node?.type==="ExpressionStatement"&&node?.expression?.callee?.name==="useEffect"));}return astStructure;});}}};}
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=_default;/**
|
|
8
2
|
* @description babel plugin used to remove unwanted code from the build.
|
|
9
3
|
* @return babel plugin object
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
name: "ast-transform",
|
|
14
|
-
// not required
|
|
15
|
-
visitor: {
|
|
16
|
-
ImportDefaultSpecifier(path) {
|
|
17
|
-
path.parentPath.parent.body = path.parentPath.parent.body.filter(val => val?.expression?.left?.property?.name !== "serverSideFunction");
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
4
|
+
*/function _default(){return{name:"ast-transform",// not required
|
|
5
|
+
visitor:{ImportDefaultSpecifier(path){path.parentPath.parent.body=path.parentPath.parent.body.filter(val=>val?.expression?.left?.property?.name!=="serverSideFunction");}}};}
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = exports.default = {
|
|
8
|
-
babelrc: false,
|
|
9
|
-
presets: [["@babel/preset-env", {
|
|
10
|
-
targets: {
|
|
11
|
-
browsers: "last 2 versions"
|
|
12
|
-
}
|
|
13
|
-
}], "@babel/preset-react"],
|
|
14
|
-
plugins: ["@loadable/babel-plugin"],
|
|
15
|
-
env: {
|
|
16
|
-
production: {
|
|
17
|
-
plugins: [require("./babel-plugins/remove-ssr.plugin").default, "transform-react-remove-prop-types"]
|
|
18
|
-
},
|
|
19
|
-
test: {
|
|
20
|
-
presets: ["@babel/preset-react"]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
ignore: ["__TEST__"]
|
|
24
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _default=exports.default={babelrc:false,presets:[["@babel/preset-env",{targets:{browsers:"last 2 versions"}}],"@babel/preset-react"],plugins:["@loadable/babel-plugin"],env:{production:{plugins:[require("./babel-plugins/remove-ssr.plugin").default,"transform-react-remove-prop-types"]},test:{presets:["@babel/preset-react"]}},ignore:["__TEST__"]};
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = exports.default = {
|
|
8
|
-
babelrc: false,
|
|
9
|
-
presets: [["@babel/preset-env", {
|
|
10
|
-
targets: {
|
|
11
|
-
node: "current"
|
|
12
|
-
}
|
|
13
|
-
}], "@babel/preset-react"],
|
|
14
|
-
plugins: ["@loadable/babel-plugin"],
|
|
15
|
-
env: {
|
|
16
|
-
development: {
|
|
17
|
-
plugins: ["react-refresh/babel"]
|
|
18
|
-
},
|
|
19
|
-
production: {
|
|
20
|
-
plugins: [require("./babel-plugins/remove-client.plugin").default, "transform-react-remove-prop-types"]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
ignore: ["__TEST__"]
|
|
24
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _default=exports.default={babelrc:false,presets:[["@babel/preset-env",{targets:{node:"current"}}],"@babel/preset-react"],plugins:["@loadable/babel-plugin"],env:{development:{plugins:["react-refresh/babel"]},production:{plugins:[require("./babel-plugins/remove-client.plugin").default,"transform-react-remove-prop-types"]}},ignore:["__TEST__"]};
|
package/webpack/base.babel.js
CHANGED
|
@@ -1,175 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
10
|
-
var _webpackBundleAnalyzer = require("webpack-bundle-analyzer");
|
|
11
|
-
var _webpackPlugin = _interopRequireDefault(require("@loadable/webpack-plugin"));
|
|
12
|
-
var _scssParams = require("./scssParams");
|
|
13
|
-
var _babelConfig = _interopRequireDefault(require("./babel.config.client"));
|
|
14
|
-
var _babelConfig2 = _interopRequireDefault(require("./babel.config.ssr"));
|
|
15
|
-
var _loadEnvironmentVariables = _interopRequireDefault(require("../scripts/loadEnvironmentVariables"));
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
const catalystConfig = require(_path.default.resolve(__dirname, "..", "config.json"));
|
|
18
|
-
const {
|
|
19
|
-
CLIENT_ENV_VARIABLES: clientEnv,
|
|
20
|
-
ANALYZE_BUNDLE
|
|
21
|
-
} = require(`${process.env.src_path}/config/config.json`);
|
|
22
|
-
const {
|
|
23
|
-
_moduleAliases
|
|
24
|
-
} = require(`${process.env.src_path}/package.json`);
|
|
25
|
-
(0, _loadEnvironmentVariables.default)();
|
|
26
|
-
const isDev = process.env.NODE_ENV === "development";
|
|
27
|
-
const isSSR = !!process.env.SSR || false;
|
|
28
|
-
const basePlugins = exports.basePlugins = [new _webpackPlugin.default({
|
|
29
|
-
filename: "loadable-stats.json",
|
|
30
|
-
writeToDisk: {
|
|
31
|
-
filename: _path.default.join(__dirname, "..")
|
|
32
|
-
}
|
|
33
|
-
}),
|
|
34
|
-
// **This loads process.env variable during webpack build process
|
|
35
|
-
new _webpack.default.DefinePlugin({
|
|
36
|
-
"process.env": ([...clientEnv, ...Object.keys(process.env)] || []).reduce((clientEnvMap, env) => {
|
|
37
|
-
clientEnvMap[env] = JSON.stringify(process.env[env]);
|
|
38
|
-
return clientEnvMap;
|
|
39
|
-
}, {})
|
|
40
|
-
}),
|
|
41
|
-
// ** This is used to analyze bundle size.
|
|
42
|
-
ANALYZE_BUNDLE && new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
|
43
|
-
generateStatsFile: ANALYZE_BUNDLE
|
|
44
|
-
}), new _webpack.default.IgnorePlugin({
|
|
45
|
-
resourceRegExp: /^\.\/locale$/,
|
|
46
|
-
contextRegExp: /moment$/
|
|
47
|
-
})];
|
|
48
|
-
const {
|
|
49
|
-
IS_DEV_COMMAND,
|
|
50
|
-
PUBLIC_STATIC_ASSET_URL,
|
|
51
|
-
PUBLIC_STATIC_ASSET_PATH,
|
|
52
|
-
WEBPACK_DEV_SERVER_HOSTNAME,
|
|
53
|
-
WEBPACK_DEV_SERVER_PORT,
|
|
54
|
-
NODE_SERVER_HOSTNAME,
|
|
55
|
-
NODE_SERVER_PORT
|
|
56
|
-
} = process.env;
|
|
57
|
-
let publicPath = isDev ? `http://${WEBPACK_DEV_SERVER_HOSTNAME}:${WEBPACK_DEV_SERVER_PORT}/` : `${PUBLIC_STATIC_ASSET_URL}${PUBLIC_STATIC_ASSET_PATH}`;
|
|
58
|
-
|
|
59
|
-
// serves assets from local on running devBuild and devServe command
|
|
60
|
-
if (JSON.parse(IS_DEV_COMMAND) && !isDev) {
|
|
61
|
-
publicPath = `http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}/assets/`;
|
|
62
|
-
}
|
|
63
|
-
var _default = exports.default = {
|
|
64
|
-
context: _path.default.resolve(process.env.src_path),
|
|
65
|
-
mode: isDev ? "development" : "production",
|
|
66
|
-
entry: {
|
|
67
|
-
app: [_path.default.resolve(process.env.src_path, "./client/index.js")]
|
|
68
|
-
},
|
|
69
|
-
output: {
|
|
70
|
-
path: _path.default.join(process.env.src_path, `${process.env.BUILD_OUTPUT_PATH}/public`),
|
|
71
|
-
chunkFilename: process.env.NODE_ENV === "development" ? catalystConfig.chunkFileNameDev : catalystConfig.chunkFileNameProd,
|
|
72
|
-
publicPath: publicPath,
|
|
73
|
-
chunkFilename: process.env.NODE_ENV === "development" ? catalystConfig.chunkFileNameDev : catalystConfig.chunkFileNameProd
|
|
74
|
-
},
|
|
75
|
-
resolve: {
|
|
76
|
-
fallback: {
|
|
77
|
-
url: require.resolve("url")
|
|
78
|
-
},
|
|
79
|
-
extensions: [".js", ".jsx", ".scss"],
|
|
80
|
-
alias: Object.keys(_moduleAliases || {}).reduce((moduleEnvMap, alias) => {
|
|
81
|
-
moduleEnvMap[alias] = _path.default.join(process.env.src_path, ..._moduleAliases[alias].split("/"));
|
|
82
|
-
return moduleEnvMap;
|
|
83
|
-
}, {})
|
|
84
|
-
},
|
|
85
|
-
plugins: basePlugins,
|
|
86
|
-
module: {
|
|
87
|
-
rules: [{
|
|
88
|
-
test: /\.jsx$|\.js$/,
|
|
89
|
-
exclude: _path.default.resolve(process.env.src_path, "./node_modules"),
|
|
90
|
-
use: {
|
|
91
|
-
loader: "babel-loader",
|
|
92
|
-
options: isSSR ? _babelConfig2.default : _babelConfig.default
|
|
93
|
-
}
|
|
94
|
-
}, {
|
|
95
|
-
// This loader processes all the .scss files that should be modularized. This should exclude anything inside node_modules and everything inside src/css/base since they should be globally scoped.
|
|
96
|
-
test: /\.scss$/,
|
|
97
|
-
exclude: [_path.default.resolve(process.env.src_path, "./node_modules"), _path.default.resolve(process.env.src_path, "./src/static/css/base")],
|
|
98
|
-
use: [isDev && "css-hot-loader", !isSSR && _miniCssExtractPlugin.default.loader, {
|
|
99
|
-
loader: "css-loader",
|
|
100
|
-
options: {
|
|
101
|
-
modules: {
|
|
102
|
-
mode: "local",
|
|
103
|
-
exportOnlyLocals: !isDev && isSSR,
|
|
104
|
-
localIdentName: isDev ? catalystConfig.cssModulesIdentifierDev : catalystConfig.cssModulesIdentifierProd
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}, {
|
|
108
|
-
loader: "postcss-loader"
|
|
109
|
-
}, {
|
|
110
|
-
loader: "sass-loader",
|
|
111
|
-
options: {
|
|
112
|
-
additionalData: "$font_url: " + (0, _scssParams.fontUrl)() + ";" + "$url_for: " + (0, _scssParams.imageUrl)() + ";"
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
loader: "sass-resources-loader",
|
|
116
|
-
options: {
|
|
117
|
-
resources: [_path.default.resolve(process.env.src_path, "./src/static/css/resources/*.scss")]
|
|
118
|
-
}
|
|
119
|
-
}]
|
|
120
|
-
}, {
|
|
121
|
-
// In development mode, client request app.css ,which has all the css in node_modules and src/static/css/base, This is served by webpack-dev-server. However in prod this css is injected in the doc sent from the server and needs to be global, so we don't pass the files through css-loader to be modularized.
|
|
122
|
-
test: /\.scss$/,
|
|
123
|
-
include: [_path.default.resolve(process.env.src_path, "./node_modules"), _path.default.resolve(process.env.src_path, "./src/static/css/base")],
|
|
124
|
-
use: [isDev && "css-hot-loader", !isSSR && _miniCssExtractPlugin.default.loader, {
|
|
125
|
-
loader: "css-loader"
|
|
126
|
-
}, {
|
|
127
|
-
loader: "postcss-loader"
|
|
128
|
-
}, {
|
|
129
|
-
loader: "sass-loader",
|
|
130
|
-
options: {
|
|
131
|
-
additionalData: "$font_url: " + (0, _scssParams.fontUrl)() + ";" + "$url_for: " + (0, _scssParams.imageUrl)() + ";"
|
|
132
|
-
}
|
|
133
|
-
}, {
|
|
134
|
-
loader: "sass-resources-loader",
|
|
135
|
-
options: {
|
|
136
|
-
resources: [_path.default.resolve(process.env.src_path, "./src/static/css/resources/*.scss")]
|
|
137
|
-
}
|
|
138
|
-
}]
|
|
139
|
-
}, {
|
|
140
|
-
test: /\.css$/,
|
|
141
|
-
use: [!isSSR && _miniCssExtractPlugin.default.loader, "css-loader", "postcss-loader"]
|
|
142
|
-
}, {
|
|
143
|
-
test: /\.(png|jpg|gif|jpeg|ico?)$/,
|
|
144
|
-
use: ["url-loader?limit=10240", "img-loader"]
|
|
145
|
-
}, {
|
|
146
|
-
test: /\.svg$/i,
|
|
147
|
-
issuer: /\.[jt]sx?$/,
|
|
148
|
-
use: ["@svgr/webpack", "url-loader?limit=10240", "img-loader"]
|
|
149
|
-
}, {
|
|
150
|
-
// This loader loads fonts in src/static/fonts using file-loader
|
|
151
|
-
test: /\.(ttf|eot|woff2|json?)$/,
|
|
152
|
-
use: [{
|
|
153
|
-
loader: "url-loader",
|
|
154
|
-
options: {
|
|
155
|
-
limit: 10240,
|
|
156
|
-
outputPath: [_path.default.resolve(process.env.src_path, "./src/static/fonts/")]
|
|
157
|
-
}
|
|
158
|
-
}, "file-loader"]
|
|
159
|
-
}, {
|
|
160
|
-
// This loader loads html files
|
|
161
|
-
test: /\.html$/,
|
|
162
|
-
use: [{
|
|
163
|
-
loader: "html-loader",
|
|
164
|
-
options: {
|
|
165
|
-
minimize: {
|
|
166
|
-
minifyJS: true,
|
|
167
|
-
minifyCSS: true,
|
|
168
|
-
removeComments: false,
|
|
169
|
-
collapseWhitespace: true
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}]
|
|
173
|
-
}]
|
|
174
|
-
}
|
|
175
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.basePlugins=void 0;var _path=_interopRequireDefault(require("path"));var _webpack=_interopRequireDefault(require("webpack"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _webpackBundleAnalyzer=require("webpack-bundle-analyzer");var _webpackPlugin=_interopRequireDefault(require("@loadable/webpack-plugin"));var _scssParams=require("./scssParams");var _babelConfig=_interopRequireDefault(require("./babel.config.client"));var _babelConfig2=_interopRequireDefault(require("./babel.config.ssr"));var _loadEnvironmentVariables=_interopRequireDefault(require("../scripts/loadEnvironmentVariables"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const catalystConfig=require(_path.default.resolve(__dirname,"..","config.json"));const{CLIENT_ENV_VARIABLES:clientEnv,ANALYZE_BUNDLE}=require(`${process.env.src_path}/config/config.json`);const{_moduleAliases}=require(`${process.env.src_path}/package.json`);(0,_loadEnvironmentVariables.default)();const isDev=process.env.NODE_ENV==="development";const isSSR=!!process.env.SSR||false;const basePlugins=exports.basePlugins=[new _webpackPlugin.default({filename:"loadable-stats.json",writeToDisk:{filename:_path.default.join(__dirname,"..")}}),// **This loads process.env variable during webpack build process
|
|
2
|
+
new _webpack.default.DefinePlugin({"process.env":([...clientEnv,...Object.keys(process.env)]||[]).reduce((clientEnvMap,env)=>{clientEnvMap[env]=JSON.stringify(process.env[env]);return clientEnvMap;},{})}),// ** This is used to analyze bundle size.
|
|
3
|
+
ANALYZE_BUNDLE&&new _webpackBundleAnalyzer.BundleAnalyzerPlugin({generateStatsFile:ANALYZE_BUNDLE}),new _webpack.default.IgnorePlugin({resourceRegExp:/^\.\/locale$/,contextRegExp:/moment$/})];const{IS_DEV_COMMAND,PUBLIC_STATIC_ASSET_URL,PUBLIC_STATIC_ASSET_PATH,WEBPACK_DEV_SERVER_HOSTNAME,WEBPACK_DEV_SERVER_PORT,NODE_SERVER_HOSTNAME,NODE_SERVER_PORT}=process.env;let publicPath=isDev?`http://${WEBPACK_DEV_SERVER_HOSTNAME}:${WEBPACK_DEV_SERVER_PORT}/`:`${PUBLIC_STATIC_ASSET_URL}${PUBLIC_STATIC_ASSET_PATH}`;// serves assets from local on running devBuild and devServe command
|
|
4
|
+
if(JSON.parse(IS_DEV_COMMAND)&&!isDev){publicPath=`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}/assets/`;}var _default=exports.default={context:_path.default.resolve(process.env.src_path),mode:isDev?"development":"production",entry:{app:[_path.default.resolve(process.env.src_path,"./client/index.js")]},output:{path:_path.default.join(process.env.src_path,`${process.env.BUILD_OUTPUT_PATH}/public`),chunkFilename:process.env.NODE_ENV==="development"?catalystConfig.chunkFileNameDev:catalystConfig.chunkFileNameProd,publicPath:publicPath},resolve:{fallback:{url:require.resolve("url")},extensions:[".js",".jsx",".scss"],alias:Object.keys(_moduleAliases||{}).reduce((moduleEnvMap,alias)=>{moduleEnvMap[alias]=_path.default.join(process.env.src_path,..._moduleAliases[alias].split("/"));return moduleEnvMap;},{})},plugins:basePlugins,module:{rules:[{test:/\.jsx$|\.js$/,exclude:_path.default.resolve(process.env.src_path,"./node_modules"),use:{loader:"babel-loader",options:isSSR?_babelConfig2.default:_babelConfig.default}},{// This loader processes all the .scss files that should be modularized. This should exclude anything inside node_modules and everything inside src/css/base since they should be globally scoped.
|
|
5
|
+
test:/\.scss$/,exclude:[_path.default.resolve(process.env.src_path,"./node_modules"),_path.default.resolve(process.env.src_path,"./src/static/css/base")],use:[isDev&&"css-hot-loader",!isSSR&&_miniCssExtractPlugin.default.loader,{loader:"css-loader",options:{modules:{mode:"local",exportOnlyLocals:!isDev&&isSSR,localIdentName:isDev?catalystConfig.cssModulesIdentifierDev:catalystConfig.cssModulesIdentifierProd}}},{loader:"postcss-loader"},{loader:"sass-loader",options:{additionalData:"$font_url: "+(0,_scssParams.fontUrl)()+";"+"$url_for: "+(0,_scssParams.imageUrl)()+";"}},{loader:"sass-resources-loader",options:{resources:[_path.default.resolve(process.env.src_path,"./src/static/css/resources/*.scss")]}}]},{// In development mode, client request app.css ,which has all the css in node_modules and src/static/css/base, This is served by webpack-dev-server. However in prod this css is injected in the doc sent from the server and needs to be global, so we don't pass the files through css-loader to be modularized.
|
|
6
|
+
test:/\.scss$/,include:[_path.default.resolve(process.env.src_path,"./node_modules"),_path.default.resolve(process.env.src_path,"./src/static/css/base")],use:[isDev&&"css-hot-loader",!isSSR&&_miniCssExtractPlugin.default.loader,{loader:"css-loader"},{loader:"postcss-loader"},{loader:"sass-loader",options:{additionalData:"$font_url: "+(0,_scssParams.fontUrl)()+";"+"$url_for: "+(0,_scssParams.imageUrl)()+";"}},{loader:"sass-resources-loader",options:{resources:[_path.default.resolve(process.env.src_path,"./src/static/css/resources/*.scss")]}}]},{test:/\.css$/,use:[!isSSR&&_miniCssExtractPlugin.default.loader,"css-loader","postcss-loader"]},{test:/\.(png|jpg|gif|jpeg|ico?)$/,use:["url-loader?limit=10240","img-loader"]},{test:/\.svg$/i,issuer:/\.[jt]sx?$/,use:["@svgr/webpack","url-loader?limit=10240","img-loader"]},{// This loader loads fonts in src/static/fonts using file-loader
|
|
7
|
+
test:/\.(ttf|eot|woff2|json?)$/,use:[{loader:"url-loader",options:{limit:10240,outputPath:[_path.default.resolve(process.env.src_path,"./src/static/fonts/")]}},"file-loader"]},{// This loader loads html files
|
|
8
|
+
test:/\.html$/,use:[{loader:"html-loader",options:{minimize:{minifyJS:true,minifyCSS:true,removeComments:false,collapseWhitespace:true}}}]}]}};
|
|
@@ -1,85 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _webpack = _interopRequireDefault(require("webpack"));
|
|
6
|
-
var _webpackMerge = _interopRequireDefault(require("webpack-merge"));
|
|
7
|
-
var _baseBabel = _interopRequireDefault(require("./base.babel.js"));
|
|
8
|
-
var _reactRefreshWebpackPlugin = _interopRequireDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
|
|
9
|
-
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
/* eslint-disable no-console */
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
WEBPACK_DEV_SERVER_PORT,
|
|
15
|
-
WEBPACK_DEV_SERVER_HOSTNAME,
|
|
16
|
-
NODE_SERVER_PORT,
|
|
17
|
-
NODE_SERVER_HOSTNAME
|
|
18
|
-
} = process.env;
|
|
19
|
-
const catalystConfig = require(_path.default.resolve(__dirname, "..", "config.json"));
|
|
20
|
-
const plugins = require(_path.default.join(process.env.src_path, "webpackConfig.js"));
|
|
21
|
-
const webpackConfig = (0, _webpackMerge.default)(_baseBabel.default, {
|
|
22
|
-
devtool: "inline-source-map",
|
|
23
|
-
stats: "minimal",
|
|
24
|
-
plugins: [new _reactRefreshWebpackPlugin.default({
|
|
25
|
-
overlay: {
|
|
26
|
-
entry: false
|
|
27
|
-
}
|
|
28
|
-
}), new _miniCssExtractPlugin.default({
|
|
29
|
-
filename: catalystConfig.cssChunkFileName,
|
|
30
|
-
ignoreOrder: true
|
|
31
|
-
}), ...plugins.developmentPlugins].filter(Boolean),
|
|
32
|
-
optimization: {
|
|
33
|
-
runtimeChunk: "single",
|
|
34
|
-
moduleIds: "deterministic",
|
|
35
|
-
splitChunks: {
|
|
36
|
-
cacheGroups: {
|
|
37
|
-
commonVendor: {
|
|
38
|
-
test: /[\\/]node_modules[\\/](react|react-dom|react-redux|react-router|react-router-dom|redux|redux-thunk|axios|react-loadable-visibility|react-helmet-async|react-fast-compare|react-async-script|babel|@loadable\/component|catalyst)[\\/]/,
|
|
39
|
-
name: "commonVendor",
|
|
40
|
-
minSize: 30000
|
|
41
|
-
},
|
|
42
|
-
utilityVendor: {
|
|
43
|
-
maxInitialRequests: Infinity,
|
|
44
|
-
chunks: "all",
|
|
45
|
-
// minSize: 0, // Enable to replicate stand alone chunking for all packages
|
|
46
|
-
reuseExistingChunk: true,
|
|
47
|
-
// Disable to replicate stand alone chunking for all packages
|
|
48
|
-
minRemainingSize: 1000,
|
|
49
|
-
// Disable to replicate stand alone chunking for all packages
|
|
50
|
-
test: /[\\/]node_modules[\\/]/,
|
|
51
|
-
name(module) {
|
|
52
|
-
const moduleFileName = module.identifier().split("/").reduceRight(item => item);
|
|
53
|
-
return `npm.${moduleFileName}`;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
console.info("Firing up catalyst dev server...\n");
|
|
61
|
-
let devServer = new _webpackDevServer.default({
|
|
62
|
-
port: WEBPACK_DEV_SERVER_PORT,
|
|
63
|
-
host: WEBPACK_DEV_SERVER_HOSTNAME,
|
|
64
|
-
static: {
|
|
65
|
-
publicPath: webpackConfig.output.publicPath
|
|
66
|
-
},
|
|
67
|
-
hot: true,
|
|
68
|
-
historyApiFallback: true,
|
|
69
|
-
open: [`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}`],
|
|
70
|
-
headers: {
|
|
71
|
-
"Access-Control-Allow-Origin": "*"
|
|
72
|
-
},
|
|
73
|
-
client: {
|
|
74
|
-
logging: "error",
|
|
75
|
-
overlay: {
|
|
76
|
-
errors: false,
|
|
77
|
-
warnings: false,
|
|
78
|
-
runtimeErrors: false
|
|
79
|
-
},
|
|
80
|
-
reconnect: true
|
|
81
|
-
}
|
|
82
|
-
}, (0, _webpack.default)(webpackConfig));
|
|
83
|
-
devServer.startCallback(() => {
|
|
84
|
-
console.info(`Webpack dev server mounted at http://${WEBPACK_DEV_SERVER_HOSTNAME}:${WEBPACK_DEV_SERVER_PORT}.`);
|
|
85
|
-
});
|
|
1
|
+
"use strict";var _path=_interopRequireDefault(require("path"));var _webpack=_interopRequireDefault(require("webpack"));var _webpackMerge=_interopRequireDefault(require("webpack-merge"));var _baseBabel=_interopRequireDefault(require("./base.babel.js"));var _webpackDevServer=_interopRequireDefault(require("webpack-dev-server"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _reactRefreshWebpackPlugin=_interopRequireDefault(require("@pmmmwh/react-refresh-webpack-plugin"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const{WEBPACK_DEV_SERVER_PORT,WEBPACK_DEV_SERVER_HOSTNAME}=process.env;const catalystConfig=require(_path.default.resolve(__dirname,"..","config.json"));const plugins=require(_path.default.join(process.env.src_path,"webpackConfig.js"));const webpackConfig=(0,_webpackMerge.default)(_baseBabel.default,{devtool:"inline-source-map",stats:"none",infrastructureLogging:{level:"none"},plugins:[new _reactRefreshWebpackPlugin.default({overlay:{entry:false}}),new _miniCssExtractPlugin.default({filename:catalystConfig.cssChunkFileName,ignoreOrder:true}),...plugins.developmentPlugins].filter(Boolean),optimization:{runtimeChunk:"single",moduleIds:"deterministic",splitChunks:{cacheGroups:{commonVendor:{test:/[\\/]node_modules[\\/](react|react-dom|react-redux|react-router|react-router-dom|redux|redux-thunk|axios|react-loadable-visibility|react-helmet-async|react-fast-compare|react-async-script|babel|@loadable\/component|catalyst)[\\/]/,name:"commonVendor",minSize:30000},utilityVendor:{maxInitialRequests:Infinity,chunks:"all",// minSize: 0, // Enable to replicate stand alone chunking for all packages
|
|
2
|
+
reuseExistingChunk:true,// Disable to replicate stand alone chunking for all packages
|
|
3
|
+
minRemainingSize:1000,// Disable to replicate stand alone chunking for all packages
|
|
4
|
+
test:/[\\/]node_modules[\\/]/,name(module){const moduleFileName=module.identifier().split("/").reduceRight(item=>item);return`npm.${moduleFileName}`;}}}}}});let devServer=new _webpackDevServer.default({port:WEBPACK_DEV_SERVER_PORT,host:WEBPACK_DEV_SERVER_HOSTNAME,static:{publicPath:webpackConfig.output.publicPath},hot:true,historyApiFallback:true,headers:{"Access-Control-Allow-Origin":"*"},client:{logging:"error",overlay:{errors:false,warnings:false,runtimeErrors:false},reconnect:true}},(0,_webpack.default)(webpackConfig));devServer.startCallback(()=>{console.log("Catalyst is compiling your files.");console.log("Please wait until bundling is finished.\n");});
|
|
@@ -1,78 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _base = _interopRequireDefault(require("./base.babel"));
|
|
8
|
-
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
9
|
-
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
const {
|
|
12
|
-
mergeWithCustomize,
|
|
13
|
-
customizeArray,
|
|
14
|
-
customizeObject
|
|
15
|
-
} = require("webpack-merge");
|
|
16
|
-
const plugins = require(_path.default.join(process.env.src_path, "webpackConfig.js"));
|
|
17
|
-
const catalystConfig = require(_path.default.resolve(__dirname, "..", "config.json"));
|
|
18
|
-
const clientConfig = mergeWithCustomize({
|
|
19
|
-
customizeArray: customizeArray({
|
|
20
|
-
entry: "prepend",
|
|
21
|
-
plugins: "append",
|
|
22
|
-
module: "prepend"
|
|
23
|
-
}),
|
|
24
|
-
customizeObject: customizeObject({
|
|
25
|
-
entry: "prepend",
|
|
26
|
-
plugins: "append",
|
|
27
|
-
module: "prepend"
|
|
28
|
-
})
|
|
29
|
-
})(_base.default, {
|
|
30
|
-
mode: "production",
|
|
31
|
-
optimization: {
|
|
32
|
-
runtimeChunk: "single",
|
|
33
|
-
moduleIds: "deterministic",
|
|
34
|
-
splitChunks: {
|
|
35
|
-
cacheGroups: {
|
|
36
|
-
commonVendor: {
|
|
37
|
-
chunks: "all",
|
|
38
|
-
test: /[\\/]node_modules[\\/](react|react-dom|react-redux|react-router|react-router-dom|redux|redux-thunk|axios|react-loadable-visibility|react-helmet-async|react-fast-compare|react-async-script|babel|@loadable\/component|catalyst)[\\/]/,
|
|
39
|
-
name: "commonVendor",
|
|
40
|
-
minSize: 400000,
|
|
41
|
-
maxSize: 400000
|
|
42
|
-
},
|
|
43
|
-
utilityVendor: {
|
|
44
|
-
maxInitialRequests: Infinity,
|
|
45
|
-
chunks: "all",
|
|
46
|
-
// minSize: 0, // Enable to replicate stand alone chunking for all packages
|
|
47
|
-
reuseExistingChunk: true,
|
|
48
|
-
// Disable to replicate stand alone chunking for all packages
|
|
49
|
-
minRemainingSize: 1000,
|
|
50
|
-
// Disable to replicate stand alone chunking for all packages
|
|
51
|
-
minSize: 1000,
|
|
52
|
-
maxSize: 120000,
|
|
53
|
-
test: /[\\/]node_modules[\\/]/,
|
|
54
|
-
name(module) {
|
|
55
|
-
const moduleFileName = module.identifier().split("/").reverse().slice(0, 3).reduce((item, current) => {
|
|
56
|
-
item = current + "." + item;
|
|
57
|
-
return item;
|
|
58
|
-
}, []);
|
|
59
|
-
return `npm.${moduleFileName}`;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
chunks: "all",
|
|
64
|
-
name(module) {
|
|
65
|
-
const moduleFileName = module.identifier().split("/").reverse().slice(0, 3).reduce((item, current) => {
|
|
66
|
-
item = current + "." + item;
|
|
67
|
-
return item;
|
|
68
|
-
}, []);
|
|
69
|
-
return `npm.${moduleFileName}`;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
plugins: [new _miniCssExtractPlugin.default({
|
|
74
|
-
filename: catalystConfig.cssChunkFileName,
|
|
75
|
-
ignoreOrder: true
|
|
76
|
-
}), ...plugins.clientPlugins]
|
|
77
|
-
});
|
|
78
|
-
var _default = exports.default = clientConfig;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _base=_interopRequireDefault(require("./base.babel"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _path=_interopRequireDefault(require("path"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const{mergeWithCustomize,customizeArray,customizeObject}=require("webpack-merge");const plugins=require(_path.default.join(process.env.src_path,"webpackConfig.js"));const catalystConfig=require(_path.default.resolve(__dirname,"..","config.json"));const clientConfig=mergeWithCustomize({customizeArray:customizeArray({entry:"prepend",plugins:"append",module:"prepend"}),customizeObject:customizeObject({entry:"prepend",plugins:"append",module:"prepend"})})(_base.default,{mode:"production",stats:"errors-only",optimization:{runtimeChunk:"single",moduleIds:"deterministic",splitChunks:{cacheGroups:{commonVendor:{chunks:"all",test:/[\\/]node_modules[\\/](react|react-dom|react-redux|react-router|react-router-dom|redux|redux-thunk|axios|react-loadable-visibility|react-helmet-async|react-fast-compare|react-async-script|babel|@loadable\/component|catalyst)[\\/]/,name:"commonVendor",minSize:400000,maxSize:400000},utilityVendor:{maxInitialRequests:Infinity,chunks:"all",// minSize: 0, // Enable to replicate stand alone chunking for all packages
|
|
2
|
+
reuseExistingChunk:true,// Disable to replicate stand alone chunking for all packages
|
|
3
|
+
minRemainingSize:1000,// Disable to replicate stand alone chunking for all packages
|
|
4
|
+
minSize:1000,maxSize:120000,test:/[\\/]node_modules[\\/]/,name(module){const moduleFileName=module.identifier().split("/").reverse().slice(0,3).reduce((item,current)=>{item=current+"."+item;return item;},[]);return`npm.${moduleFileName}`;}}},chunks:"all",name(module){const moduleFileName=module.identifier().split("/").reverse().slice(0,3).reduce((item,current)=>{item=current+"."+item;return item;},[]);return`npm.${moduleFileName}`;}}},plugins:[new _miniCssExtractPlugin.default({filename:catalystConfig.cssChunkFileName,ignoreOrder:true}),...plugins.clientPlugins]});var _default=exports.default=clientConfig;
|