Skip to content

Commit

Permalink
perf: reduce size
Browse files Browse the repository at this point in the history
  • Loading branch information
jsers committed Mar 18, 2021
1 parent 2370314 commit ef07017
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 38 deletions.
10 changes: 10 additions & 0 deletions ams-web/config/webpack.build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ module.exports = function getwebpackConfig(webpackConfig) {

webpackConfig.output.filename = '[name]-[chunkhash].js';
webpackConfig.output.publicPath = `/${pkgJson.systemName}/`;
webpackConfig.externals = [
/^react$/,
/^react\/lib.*/,
/^react-dom$/,
/.*react-dom.*/,
/^single-spa$/,
/^antd$/,
/^moment$/,
/^d3$/
];
webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
if (plugin instanceof HtmlWebpackPlugin ||
plugin instanceof MiniCssExtractPlugin) {
Expand Down
10 changes: 10 additions & 0 deletions ams-web/config/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ module.exports = function getwebpackConfig(webpackConfig) {
});
webpackConfig.output.publicPath = `http://0.0.0.0:${fetkJson.port}/${pkgJson.systemName}/`;
webpackConfig.output.filename = '[name]-[chunkhash].js';
webpackConfig.externals = [
/^react$/,
/^react\/lib.*/,
/^react-dom$/,
/.*react-dom.*/,
/^single-spa$/,
/^antd$/,
/^moment$/,
/^d3$/
];
webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
if (plugin instanceof HtmlWebpackPlugin ||
plugin instanceof MiniCssExtractPlugin) {
Expand Down
9 changes: 0 additions & 9 deletions ams-web/fetk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ module.exports = {
eslintFix: false,
hmr: false,
port: 8002,
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'antd',
style: true,
},
],
],
devServer: {
inline: true,
historyApiFallback: true,
Expand Down
1 change: 0 additions & 1 deletion ams-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"react-sortable-hoc": "^1.8.3",
"single-spa": "^5.5.5",
"single-spa-react": "^2.14.0",
"three": "^0.56.0",
"xlsx": "^0.16.6"
},
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions job-web/config/webpack.build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ module.exports = function getwebpackConfig(webpackConfig) {

webpackConfig.output.filename = '[name]-[chunkhash].js';
webpackConfig.output.publicPath = `/${pkgJson.systemName}/`;
webpackConfig.externals = [
/^react$/,
/^react\/lib.*/,
/^react-dom$/,
/.*react-dom.*/,
/^single-spa$/,
/^antd$/,
/^moment$/,
/^d3$/
];
webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
if (plugin instanceof HtmlWebpackPlugin ||
plugin instanceof MiniCssExtractPlugin) {
Expand Down
10 changes: 10 additions & 0 deletions job-web/config/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ module.exports = function getwebpackConfig(webpackConfig) {
});
webpackConfig.output.publicPath = `http://0.0.0.0:${fetkJson.port}/${pkgJson.systemName}/`;
webpackConfig.output.filename = '[name]-[chunkhash].js';
webpackConfig.externals = [
/^react$/,
/^react\/lib.*/,
/^react-dom$/,
/.*react-dom.*/,
/^single-spa$/,
/^antd$/,
/^moment$/,
/^d3$/
];
webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
if (plugin instanceof HtmlWebpackPlugin ||
plugin instanceof MiniCssExtractPlugin) {
Expand Down
9 changes: 0 additions & 9 deletions job-web/fetk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ module.exports = {
eslintFix: false,
hmr: false,
port: 8003,
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'antd',
style: true,
},
],
],
devServer: {
inline: true,
historyApiFallback: true,
Expand Down
3 changes: 1 addition & 2 deletions job-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
"react-sortable-hoc": "^1.8.3",
"react-syntax-highlighter": "^7.0.4",
"single-spa": "^5.8.2",
"single-spa-react": "^2.14.0",
"three": "^0.56.0"
"single-spa-react": "^2.14.0"
},
"devDependencies": {
"@babel/core": "^7.5.5",
Expand Down
1 change: 0 additions & 1 deletion layout-web/config/registerApps.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as singleSpa from 'single-spa';
import React from 'react';

const customProps = {
env: {
Expand Down
10 changes: 10 additions & 0 deletions mon-web/config/webpack.build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ module.exports = function getwebpackConfig(webpackConfig) {

webpackConfig.output.filename = '[name]-[chunkhash].js';
webpackConfig.output.publicPath = `/${pkgJson.systemName}/`;
webpackConfig.externals = [
/^react$/,
/^react\/lib.*/,
/^react-dom$/,
/.*react-dom.*/,
/^single-spa$/,
/^antd$/,
/^moment$/,
/^d3$/
];
webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
if (plugin instanceof HtmlWebpackPlugin ||
plugin instanceof MiniCssExtractPlugin) {
Expand Down
10 changes: 10 additions & 0 deletions mon-web/config/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ module.exports = function getwebpackConfig(webpackConfig) {
});
webpackConfig.output.publicPath = `http://0.0.0.0:${fetkJson.port}/${pkgJson.systemName}/`;
webpackConfig.output.filename = '[name]-[chunkhash].js';
webpackConfig.externals = [
/^react$/,
/^react\/lib.*/,
/^react-dom$/,
/.*react-dom.*/,
/^single-spa$/,
/^antd$/,
/^moment$/,
/^d3$/
];
webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
if (plugin instanceof HtmlWebpackPlugin ||
plugin instanceof MiniCssExtractPlugin) {
Expand Down
4 changes: 1 addition & 3 deletions mon-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@umijs/hooks": "^1.2.0",
"ace-builds": "^1.4.11",
"antd": "^3.26.0",
"axios": "^0.19.2",
"bowser": "^2.11.0",
"classnames": "^2.2.6",
"color": "^3.1.0",
Expand Down Expand Up @@ -48,8 +47,7 @@
"react-router-dom": "4.x",
"react-sortable-hoc": "^1.8.3",
"single-spa": "^5.5.5",
"single-spa-react": "^2.14.0",
"three": "^0.56.0"
"single-spa-react": "^2.14.0"
},
"devDependencies": {
"@babel/core": "^7.5.5",
Expand Down
10 changes: 10 additions & 0 deletions rdb-web/config/webpack.build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ module.exports = function getwebpackConfig(webpackConfig) {

webpackConfig.output.filename = '[name]-[chunkhash].js';
webpackConfig.output.publicPath = `/${pkgJson.systemName}/`;
webpackConfig.externals = [
/^react$/,
/^react\/lib.*/,
/^react-dom$/,
/.*react-dom.*/,
/^single-spa$/,
/^antd$/,
/^moment$/,
/^d3$/,
];
webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
if (plugin instanceof HtmlWebpackPlugin ||
plugin instanceof MiniCssExtractPlugin) {
Expand Down
10 changes: 10 additions & 0 deletions rdb-web/config/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ module.exports = function getwebpackConfig(webpackConfig) {
});
webpackConfig.output.publicPath = `http://0.0.0.0:${fetkJson.port}/${pkgJson.systemName}/`;
webpackConfig.output.filename = '[name]-[chunkhash].js';
webpackConfig.externals = [
/^react$/,
/^react\/lib.*/,
/^react-dom$/,
/.*react-dom.*/,
/^single-spa$/,
/^antd$/,
/^moment$/,
/^d3$/,
];
webpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
if (plugin instanceof HtmlWebpackPlugin ||
plugin instanceof MiniCssExtractPlugin) {
Expand Down
9 changes: 0 additions & 9 deletions rdb-web/fetk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ module.exports = {
eslintFix: false,
hmr: false,
port: 8001,
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'antd',
style: true,
},
],
],
devServer: {
inline: true,
historyApiFallback: true,
Expand Down
2 changes: 0 additions & 2 deletions rdb-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
"react-sticky": "^6.0.3",
"single-spa": "^5.8.0",
"single-spa-react": "^2.14.0",
"three": "^0.56.0",
"whatwg-fetch": "^3.4.1",
"xlsx": "^0.16.6"
},
"devDependencies": {
Expand Down
2 changes: 0 additions & 2 deletions rdb-web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { IntlProvider } from 'react-intl';
import intlZhCN from './locales/zh';
import intlEnUS from './locales/en';
import { InjectIntlContext } from '@pkgs/hooks/useFormatMessage';
import { Page403, Page404 } from '@pkgs/Exception';
import { Login, Register } from '@pkgs/Auth';
import LayoutMain from '@pkgs/Layout/Main';
import { fetchManifest, getPathBySuffix, createStylesheetLink } from '@pkgs/utils';
import { systemName } from '@common/config';
Expand Down

0 comments on commit ef07017

Please sign in to comment.