catalyst-core-internal 0.0.1-beta.2 → 0.0.1-beta.21
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 +9 -0
- package/.eslintrc +91 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/README.md +45 -43
- package/babel.config.json +2 -5
- package/bin/catalyst.js +33 -35
- package/caching.js +1 -16
- package/changelog.md +12 -0
- package/commitlint.config.js +11 -0
- package/config.json +1 -1
- package/index.js +1 -16
- package/license +10 -0
- package/logger.js +3 -89
- package/package.json +89 -83
- package/router/ClientRouter.js +2 -18
- package/router/ServerRouter.js +1 -19
- package/router.js +1 -16
- package/scripts/build.js +9 -28
- package/scripts/checkVersion.js +1 -5
- package/scripts/devBuild.js +10 -0
- package/scripts/devServe.js +5 -0
- 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 -29
- package/scripts/start.js +5 -25
- package/scripts/validator.js +1 -130
- 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 -241
- package/server/renderer/index.js +1 -12
- package/server/renderer/render.js +8 -60
- package/server/startServer.js +6 -65
- package/server/utils/userAgentUtil.js +3 -49
- package/server/utils/validator.js +1 -130
- 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 -167
- package/webpack/development.client.babel.js +4 -82
- package/webpack/production.client.babel.js +4 -78
- package/webpack/production.ssr.babel.js +4 -61
- package/webpack/scssParams.js +5 -31
- package/packages/create-framework-app/templates/redux-js/node_modules/@babel/core/lib/config/caching.js +0 -261
- package/packages/create-framework-app/templates/redux-js/node_modules/@remix-run/router/dist/router.js +0 -4327
- package/packages/create-framework-app/templates/redux-js/node_modules/catalyst/router.js +0 -15
- package/packages/create-framework-app/templates/redux-js/node_modules/catalyst/src/router.js +0 -1
- package/packages/create-framework-app/templates/redux-js/node_modules/http-proxy-middleware/dist/router.js +0 -46
- 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/types/caching.d.ts +0 -1
- package/types/config/config.d.ts +0 -19
- package/types/index.d.ts +0 -1
- package/types/logger/index.d.ts +0 -14
- package/types/reducer/index.d.ts +0 -22
- package/types/reducer/loadableConfigReducer.d.ts +0 -9
- package/types/router/ClientRouter.d.ts +0 -5
- package/types/router/ServerRouter.d.ts +0 -7
- package/types/router/index.d.ts +0 -8
- package/types/router.d.ts +0 -1
- package/types/scripts/build.d.ts +0 -1
- package/types/scripts/loadEnvironmentVariables.d.ts +0 -5
- package/types/scripts/loadScriptsBeforeServerStarts.d.ts +0 -1
- package/types/scripts/prepare.d.ts +0 -1
- package/types/scripts/registerAliases.d.ts +0 -1
- package/types/scripts/serve.d.ts +0 -1
- package/types/scripts/start.d.ts +0 -1
- package/types/scripts/validator.d.ts +0 -9
- package/types/scripts/verifyConfig.d.ts +0 -1
- package/types/server/mainIndex.d.ts +0 -1
- package/types/server/mainServer.d.ts +0 -2
- package/types/server/renderer/document/Body.d.ts +0 -11
- package/types/server/renderer/document/Head.d.ts +0 -11
- package/types/server/renderer/document/index.d.ts +0 -2
- package/types/server/renderer/extract.d.ts +0 -18
- package/types/server/renderer/handler.d.ts +0 -6
- package/types/server/renderer/index.d.ts +0 -2
- package/types/server/renderer/render.d.ts +0 -38
- package/types/server/renderer/userAgentUtil.d.ts +0 -1
- package/types/store/index.d.ts +0 -11
- package/types/store/index.dev.d.ts +0 -8
- package/types/store/index.prod.d.ts +0 -8
- package/types/webpack/babel-plugins/remove-client.plugin.d.ts +0 -10
- package/types/webpack/babel-plugins/remove-ssr.plugin.d.ts +0 -10
- package/types/webpack/babel.config.client.d.ts +0 -21
- package/types/webpack/babel.config.d.ts +0 -16
- package/types/webpack/babel.config.ssr.d.ts +0 -21
- package/types/webpack/base.babel.d.ts +0 -184
- package/types/webpack/development.client.babel.d.ts +0 -1
- package/types/webpack/plugins/mime-types.d.ts +0 -78
- package/types/webpack/plugins/route-manifest-plugin.d.ts +0 -1
- package/types/webpack/plugins/upload-assets-plugin.d.ts +0 -1
- package/types/webpack/production.client.babel.d.ts +0 -174
- package/types/webpack/production.ssr.babel.d.ts +0 -2
- package/types/webpack/scssParams.d.ts +0 -2
- 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,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: ["@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-react-jsx", "transform-class-properties", "transform-export-extensions", "syntax-dynamic-import", "@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: ["@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-react-jsx", "transform-class-properties", "transform-export-extensions", "syntax-dynamic-import", "@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,167 +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
|
-
PUBLIC_STATIC_ASSET_URL,
|
|
50
|
-
PUBLIC_STATIC_ASSET_PATH,
|
|
51
|
-
WEBPACK_DEV_SERVER_HOSTNAME,
|
|
52
|
-
WEBPACK_DEV_SERVER_PORT
|
|
53
|
-
} = process.env;
|
|
54
|
-
let publicPath = isDev ? `http://${WEBPACK_DEV_SERVER_HOSTNAME}:${WEBPACK_DEV_SERVER_PORT}` : `${PUBLIC_STATIC_ASSET_URL}${PUBLIC_STATIC_ASSET_PATH}`;
|
|
55
|
-
var _default = exports.default = {
|
|
56
|
-
context: _path.default.resolve(process.env.src_path),
|
|
57
|
-
mode: isDev ? "development" : "production",
|
|
58
|
-
entry: {
|
|
59
|
-
app: [_path.default.resolve(process.env.src_path, "./client/index.js")]
|
|
60
|
-
},
|
|
61
|
-
output: {
|
|
62
|
-
path: _path.default.join(process.env.src_path, `${process.env.BUILD_OUTPUT_PATH}/public`),
|
|
63
|
-
chunkFilename: process.env.NODE_ENV === "development" ? catalystConfig.chunkFileNameDev : catalystConfig.chunkFileNameProd,
|
|
64
|
-
publicPath: publicPath,
|
|
65
|
-
chunkFilename: process.env.NODE_ENV === "development" ? catalystConfig.chunkFileNameDev : catalystConfig.chunkFileNameProd
|
|
66
|
-
},
|
|
67
|
-
resolve: {
|
|
68
|
-
fallback: {
|
|
69
|
-
url: require.resolve("url")
|
|
70
|
-
},
|
|
71
|
-
extensions: [".js", ".jsx", ".scss"],
|
|
72
|
-
alias: Object.keys(_moduleAliases || {}).reduce((moduleEnvMap, alias) => {
|
|
73
|
-
moduleEnvMap[alias] = _path.default.join(process.env.src_path, ..._moduleAliases[alias].split("/"));
|
|
74
|
-
return moduleEnvMap;
|
|
75
|
-
}, {})
|
|
76
|
-
},
|
|
77
|
-
plugins: basePlugins,
|
|
78
|
-
module: {
|
|
79
|
-
rules: [{
|
|
80
|
-
test: /\.jsx$|\.js$/,
|
|
81
|
-
exclude: _path.default.resolve(process.env.src_path, "./node_modules"),
|
|
82
|
-
use: {
|
|
83
|
-
loader: "babel-loader",
|
|
84
|
-
options: isSSR ? _babelConfig2.default : _babelConfig.default
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
// 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.
|
|
88
|
-
test: /\.scss$/,
|
|
89
|
-
exclude: [_path.default.resolve(process.env.src_path, "./node_modules"), _path.default.resolve(process.env.src_path, "./src/static/css/base")],
|
|
90
|
-
use: [isDev && "css-hot-loader", !isSSR && _miniCssExtractPlugin.default.loader, {
|
|
91
|
-
loader: "css-loader",
|
|
92
|
-
options: {
|
|
93
|
-
modules: {
|
|
94
|
-
mode: "local",
|
|
95
|
-
exportOnlyLocals: !isDev && isSSR,
|
|
96
|
-
localIdentName: isDev ? catalystConfig.cssModulesIdentifierDev : catalystConfig.cssModulesIdentifierProd
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}, {
|
|
100
|
-
loader: "postcss-loader"
|
|
101
|
-
}, {
|
|
102
|
-
loader: "sass-loader",
|
|
103
|
-
options: {
|
|
104
|
-
additionalData: "$font_url: " + (0, _scssParams.fontUrl)() + ";" + "$url_for: " + (0, _scssParams.imageUrl)() + ";"
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
loader: "sass-resources-loader",
|
|
108
|
-
options: {
|
|
109
|
-
resources: [_path.default.resolve(process.env.src_path, "./src/static/css/resources/*.scss")]
|
|
110
|
-
}
|
|
111
|
-
}]
|
|
112
|
-
}, {
|
|
113
|
-
// 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.
|
|
114
|
-
test: /\.scss$/,
|
|
115
|
-
include: [_path.default.resolve(process.env.src_path, "./node_modules"), _path.default.resolve(process.env.src_path, "./src/static/css/base")],
|
|
116
|
-
use: [isDev && "css-hot-loader", !isSSR && _miniCssExtractPlugin.default.loader, {
|
|
117
|
-
loader: "css-loader"
|
|
118
|
-
}, {
|
|
119
|
-
loader: "postcss-loader"
|
|
120
|
-
}, {
|
|
121
|
-
loader: "sass-loader",
|
|
122
|
-
options: {
|
|
123
|
-
additionalData: "$font_url: " + (0, _scssParams.fontUrl)() + ";" + "$url_for: " + (0, _scssParams.imageUrl)() + ";"
|
|
124
|
-
}
|
|
125
|
-
}, {
|
|
126
|
-
loader: "sass-resources-loader",
|
|
127
|
-
options: {
|
|
128
|
-
resources: [_path.default.resolve(process.env.src_path, "./src/static/css/resources/*.scss")]
|
|
129
|
-
}
|
|
130
|
-
}]
|
|
131
|
-
}, {
|
|
132
|
-
test: /\.css$/,
|
|
133
|
-
use: [!isSSR && _miniCssExtractPlugin.default.loader, "css-loader", "postcss-loader"]
|
|
134
|
-
}, {
|
|
135
|
-
test: /\.(png|jpg|gif|jpeg|ico?)$/,
|
|
136
|
-
use: ["url-loader?limit=10240", "img-loader"]
|
|
137
|
-
}, {
|
|
138
|
-
test: /\.svg$/i,
|
|
139
|
-
issuer: /\.[jt]sx?$/,
|
|
140
|
-
use: ["@svgr/webpack", "url-loader?limit=10240", "img-loader"]
|
|
141
|
-
}, {
|
|
142
|
-
// This loader loads fonts in src/static/fonts using file-loader
|
|
143
|
-
test: /\.(ttf|eot|woff2|json?)$/,
|
|
144
|
-
use: [{
|
|
145
|
-
loader: "url-loader",
|
|
146
|
-
options: {
|
|
147
|
-
limit: 10240,
|
|
148
|
-
outputPath: [_path.default.resolve(process.env.src_path, "./src/static/fonts/")]
|
|
149
|
-
}
|
|
150
|
-
}, "file-loader"]
|
|
151
|
-
}, {
|
|
152
|
-
// This loader loads html files
|
|
153
|
-
test: /\.html$/,
|
|
154
|
-
use: [{
|
|
155
|
-
loader: "html-loader",
|
|
156
|
-
options: {
|
|
157
|
-
minimize: {
|
|
158
|
-
minifyJS: true,
|
|
159
|
-
minifyCSS: true,
|
|
160
|
-
removeComments: false,
|
|
161
|
-
collapseWhitespace: true
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}]
|
|
165
|
-
}]
|
|
166
|
-
}
|
|
167
|
-
};
|
|
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,82 +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
|
-
} = process.env;
|
|
17
|
-
const catalystConfig = require(_path.default.resolve(__dirname, "..", "config.json"));
|
|
18
|
-
const plugins = require(_path.default.join(process.env.src_path, "webpackConfig.js"));
|
|
19
|
-
const webpackConfig = (0, _webpackMerge.default)(_baseBabel.default, {
|
|
20
|
-
devtool: "inline-source-map",
|
|
21
|
-
stats: "minimal",
|
|
22
|
-
plugins: [new _reactRefreshWebpackPlugin.default({
|
|
23
|
-
overlay: {
|
|
24
|
-
entry: false
|
|
25
|
-
}
|
|
26
|
-
}), new _miniCssExtractPlugin.default({
|
|
27
|
-
filename: catalystConfig.cssChunkFileName,
|
|
28
|
-
ignoreOrder: true
|
|
29
|
-
}), ...plugins.developmentPlugins].filter(Boolean),
|
|
30
|
-
optimization: {
|
|
31
|
-
runtimeChunk: "single",
|
|
32
|
-
moduleIds: "deterministic",
|
|
33
|
-
splitChunks: {
|
|
34
|
-
cacheGroups: {
|
|
35
|
-
commonVendor: {
|
|
36
|
-
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)[\\/]/,
|
|
37
|
-
name: "commonVendor",
|
|
38
|
-
minSize: 30000
|
|
39
|
-
},
|
|
40
|
-
utilityVendor: {
|
|
41
|
-
maxInitialRequests: Infinity,
|
|
42
|
-
chunks: "all",
|
|
43
|
-
// minSize: 0, // Enable to replicate stand alone chunking for all packages
|
|
44
|
-
reuseExistingChunk: true,
|
|
45
|
-
// Disable to replicate stand alone chunking for all packages
|
|
46
|
-
minRemainingSize: 1000,
|
|
47
|
-
// Disable to replicate stand alone chunking for all packages
|
|
48
|
-
test: /[\\/]node_modules[\\/]/,
|
|
49
|
-
name(module) {
|
|
50
|
-
const moduleFileName = module.identifier().split("/").reduceRight(item => item);
|
|
51
|
-
return `npm.${moduleFileName}`;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
console.info("Firing up catalyst dev server...\n");
|
|
59
|
-
let devServer = new _webpackDevServer.default({
|
|
60
|
-
port: process.env.WEBPACK_DEV_SERVER_PORT,
|
|
61
|
-
host: process.env.WEBPACK_DEV_SERVER_HOSTNAME,
|
|
62
|
-
static: {
|
|
63
|
-
publicPath: webpackConfig.output.publicPath
|
|
64
|
-
},
|
|
65
|
-
hot: true,
|
|
66
|
-
historyApiFallback: true,
|
|
67
|
-
headers: {
|
|
68
|
-
"Access-Control-Allow-Origin": "*"
|
|
69
|
-
},
|
|
70
|
-
client: {
|
|
71
|
-
logging: "error",
|
|
72
|
-
overlay: {
|
|
73
|
-
errors: false,
|
|
74
|
-
warnings: false,
|
|
75
|
-
runtimeErrors: false
|
|
76
|
-
},
|
|
77
|
-
reconnect: true
|
|
78
|
-
}
|
|
79
|
-
}, (0, _webpack.default)(webpackConfig));
|
|
80
|
-
devServer.startCallback(() => {
|
|
81
|
-
console.info(`Webpack dev server mounted at http://${WEBPACK_DEV_SERVER_HOSTNAME}:${WEBPACK_DEV_SERVER_PORT}.`);
|
|
82
|
-
});
|
|
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;
|
|
@@ -1,61 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _webpackNodeExternals = _interopRequireDefault(require("webpack-node-externals"));
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
var _base = _interopRequireDefault(require("./base.babel"));
|
|
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 rootWorkspacePath = require("app-root-path");
|
|
17
|
-
const catalystConfig = require(_path.default.resolve(__dirname, "..", "config.json"));
|
|
18
|
-
const plugins = require(_path.default.join(process.env.src_path, "webpackConfig.js"));
|
|
19
|
-
const ssrConfig = mergeWithCustomize({
|
|
20
|
-
customizeArray: customizeArray({
|
|
21
|
-
entry: "replace",
|
|
22
|
-
optimization: "replace",
|
|
23
|
-
plugins: "prepend"
|
|
24
|
-
}),
|
|
25
|
-
customizeObject: customizeObject({
|
|
26
|
-
entry: "replace",
|
|
27
|
-
optimization: "replace",
|
|
28
|
-
plugins: "prepend"
|
|
29
|
-
})
|
|
30
|
-
})(_base.default, {
|
|
31
|
-
mode: "production",
|
|
32
|
-
optimization: {
|
|
33
|
-
splitChunks: {
|
|
34
|
-
chunks: "all",
|
|
35
|
-
minSize: 10000000,
|
|
36
|
-
name: false
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
plugins: [...plugins.ssrPlugins],
|
|
40
|
-
target: "node",
|
|
41
|
-
entry: {
|
|
42
|
-
handler: _path.default.resolve(__dirname, "..", "./server/renderer/handler.js")
|
|
43
|
-
},
|
|
44
|
-
externals: [
|
|
45
|
-
// images are handled by isomorphic webpack.
|
|
46
|
-
// html files are required directly
|
|
47
|
-
/\.(html|png|gif|jpg)$/,
|
|
48
|
-
// treat all node modules as external to keep this bundle small
|
|
49
|
-
(0, _webpackNodeExternals.default)({
|
|
50
|
-
modulesDir: _path.default.resolve(process.env.src_path, "./node_modules")
|
|
51
|
-
}), (0, _webpackNodeExternals.default)({
|
|
52
|
-
modulesDir: _path.default.join(rootWorkspacePath.path, "./node_modules")
|
|
53
|
-
})],
|
|
54
|
-
output: {
|
|
55
|
-
path: _path.default.join(process.env.src_path, process.env.BUILD_OUTPUT_PATH, "/renderer"),
|
|
56
|
-
chunkFilename: catalystConfig.chunkFileNameProd,
|
|
57
|
-
filename: "handler.js",
|
|
58
|
-
libraryTarget: "commonjs"
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
var _default = exports.default = ssrConfig;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _webpackNodeExternals=_interopRequireDefault(require("webpack-node-externals"));var _path=_interopRequireDefault(require("path"));var _base=_interopRequireDefault(require("./base.babel"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const{mergeWithCustomize,customizeArray,customizeObject}=require("webpack-merge");const rootWorkspacePath=require("app-root-path");const catalystConfig=require(_path.default.resolve(__dirname,"..","config.json"));const plugins=require(_path.default.join(process.env.src_path,"webpackConfig.js"));const ssrConfig=mergeWithCustomize({customizeArray:customizeArray({entry:"replace",optimization:"replace",plugins:"prepend"}),customizeObject:customizeObject({entry:"replace",optimization:"replace",plugins:"prepend"})})(_base.default,{mode:"production",stats:"errors-only",optimization:{splitChunks:{chunks:"all",minSize:10000000,name:false}},plugins:[...plugins.ssrPlugins],target:"node",entry:{handler:_path.default.resolve(__dirname,"..","./server/renderer/handler.js")},externals:[// images are handled by isomorphic webpack.
|
|
2
|
+
// html files are required directly
|
|
3
|
+
/\.(html|png|gif|jpg)$/,// treat all node modules as external to keep this bundle small
|
|
4
|
+
(0,_webpackNodeExternals.default)({modulesDir:_path.default.resolve(process.env.src_path,"./node_modules")}),(0,_webpackNodeExternals.default)({modulesDir:_path.default.join(rootWorkspacePath.path,"./node_modules")})],output:{path:_path.default.join(process.env.src_path,process.env.BUILD_OUTPUT_PATH,"/renderer"),chunkFilename:catalystConfig.chunkFileNameProd,filename:"handler.js",libraryTarget:"commonjs"}});var _default=exports.default=ssrConfig;
|
package/webpack/scssParams.js
CHANGED
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.imageUrl = exports.fontUrl = void 0;
|
|
7
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.imageUrl=exports.fontUrl=void 0;/**
|
|
8
2
|
* @description generate assets url according to enviorment
|
|
9
3
|
* @returns returns path required for loading assets according to enviorment
|
|
10
|
-
*/
|
|
11
|
-
const
|
|
12
|
-
const {
|
|
13
|
-
PUBLIC_STATIC_ASSET_URL,
|
|
14
|
-
PUBLIC_STATIC_ASSET_PATH
|
|
15
|
-
} = process.env;
|
|
16
|
-
let publicPath = `${PUBLIC_STATIC_ASSET_URL}${PUBLIC_STATIC_ASSET_PATH}`;
|
|
17
|
-
const imagePath = JSON.stringify(`${publicPath}images/`);
|
|
18
|
-
return imagePath;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
4
|
+
*/const imageUrl=()=>{const{PUBLIC_STATIC_ASSET_URL,PUBLIC_STATIC_ASSET_PATH,IS_DEV_COMMAND,NODE_SERVER_HOSTNAME,NODE_SERVER_PORT}=process.env;let publicPath=`${PUBLIC_STATIC_ASSET_URL}${PUBLIC_STATIC_ASSET_PATH}`;// serves assets from localhost on running devBuild and devServe command
|
|
5
|
+
if(JSON.parse(IS_DEV_COMMAND)){publicPath=`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}/${PUBLIC_STATIC_ASSET_PATH}`;}const imagePath=JSON.stringify(`${publicPath}images/`);return imagePath;};/**
|
|
22
6
|
* @description generate assets font url according to enviorment
|
|
23
7
|
* @returns returns path required for loading fonts according to enviorment
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const fontUrl = () => {
|
|
27
|
-
const {
|
|
28
|
-
PUBLIC_STATIC_ASSET_URL,
|
|
29
|
-
PUBLIC_STATIC_ASSET_PATH
|
|
30
|
-
} = process.env;
|
|
31
|
-
let publicPath = `${PUBLIC_STATIC_ASSET_URL}${PUBLIC_STATIC_ASSET_PATH}`;
|
|
32
|
-
const fontPath = JSON.stringify(`${publicPath}fonts/`);
|
|
33
|
-
return fontPath;
|
|
34
|
-
};
|
|
35
|
-
exports.fontUrl = fontUrl;
|
|
8
|
+
*/exports.imageUrl=imageUrl;const fontUrl=()=>{const{PUBLIC_STATIC_ASSET_URL,PUBLIC_STATIC_ASSET_PATH,IS_DEV_COMMAND,NODE_SERVER_HOSTNAME,NODE_SERVER_PORT}=process.env;let publicPath=`${PUBLIC_STATIC_ASSET_URL}${PUBLIC_STATIC_ASSET_PATH}`;// serves assets from localhost on running devBuild and devServe command
|
|
9
|
+
if(JSON.parse(IS_DEV_COMMAND)){publicPath=`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}/${PUBLIC_STATIC_ASSET_PATH}`;}const fontPath=JSON.stringify(`${publicPath}fonts/`);return fontPath;};exports.fontUrl=fontUrl;
|