Skip to content

Commit 4a81f36

Browse files
优化webpack打包并解决消费方字体图标加载问题
1 parent 99270e5 commit 4a81f36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2498
-358
lines changed

vue-app1/src/App.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Author: Jason chen
55
* @Date: 2021-08-18 15:09:23
66
* @LastEditors: Jason chen
7-
* @LastEditTime: 2021-09-06 16:09:26
7+
* @LastEditTime: 2021-09-07 10:57:13
88
-->
99
<template>
1010
<div class="vue-app1">
@@ -15,7 +15,8 @@
1515
<div>引入图片:<img src="./assets/images/webpackimage.png" alt="" /></div>
1616
<div>引入字体图标(CSS):<span class="iconfont icon-zuhe"></span></div>
1717
<div>
18-
引入字体图标(JS):<svg class="icon" aria-hidden="true">
18+
引入字体图标(JS):
19+
<svg class="icon" aria-hidden="true">
1920
<use xlink:href="#icon-dulitixi-copy-copy-copy-copy-copy"></use>
2021
</svg>
2122
</div>

vue-app1/webpack.config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Author: Jason chen
55
* @Date: 2021-08-18 14:09:16
66
* @LastEditors: Jason chen
7-
* @LastEditTime: 2021-09-06 15:52:48
7+
* @LastEditTime: 2021-09-07 10:49:38
88
*/
99
const { resolve } = require('path')
1010
const HtmlWebpackPlugin = require('html-webpack-plugin')
@@ -122,7 +122,6 @@ const result = {
122122
'./untils': './src/untils/count.js',
123123
'./appOneChildren': './src/App.vue',
124124
'./appOneIconfont': './src/assets/iconfont/iconfont.js',
125-
'./appOneIconfontCss': './src/assets/iconfont/iconfont.css'
126125
},
127126
})
128127
],

vue-app3/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
"copy-webpack-plugin": "^9.0.1",
1616
"cross-env": "^7.0.3",
1717
"css-loader": "^6.2.0",
18+
"file-loader": "^6.2.0",
1819
"friendly-errors-webpack-plugin": "^1.7.0",
1920
"html-webpack-plugin": "^5.3.2",
2021
"less": "^4.1.1",
2122
"less-loader": "^10.0.1",
23+
"mini-css-extract-plugin": "^2.2.2",
2224
"progress-bar-webpack-plugin": "^2.1.0",
2325
"style-loader": "^3.2.1",
2426
"url-loader": "^4.1.1",

vue-app3/public/mfpApps/app1/deploy/app1.js

+82-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var vueAppOne;
1717
\***********************/
1818
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1919

20-
eval("var moduleMap = {\n\t\"./applang\": () => {\n\t\treturn Promise.all([__webpack_require__.e(\"vendors-node_modules_vue-i18n_dist_vue-i18n_esm_js-node_modules_vue_dist_vue_runtime_esm_js\"), __webpack_require__.e(\"src_language_index_js\")]).then(() => (() => ((__webpack_require__(/*! ./src/language/index.js */ \"./src/language/index.js\")))));\n\t},\n\t\"./cloneDeep\": () => {\n\t\treturn Promise.all([__webpack_require__.e(\"vendors-node_modules_lodash_lodash_js\"), __webpack_require__.e(\"src_untils_cloneDeep_js\")]).then(() => (() => ((__webpack_require__(/*! ./src/untils/cloneDeep.js */ \"./src/untils/cloneDeep.js\")))));\n\t},\n\t\"./untils\": () => {\n\t\treturn __webpack_require__.e(\"src_untils_count_js\").then(() => (() => ((__webpack_require__(/*! ./src/untils/count.js */ \"./src/untils/count.js\")))));\n\t},\n\t\"./appOneChildren\": () => {\n\t\treturn __webpack_require__.e(\"src_App_vue\").then(() => (() => ((__webpack_require__(/*! ./src/App.vue */ \"./src/App.vue\")))));\n\t}\n};\nvar get = (module, getScope) => {\n\t__webpack_require__.R = getScope;\n\tgetScope = (\n\t\t__webpack_require__.o(moduleMap, module)\n\t\t\t? moduleMap[module]()\n\t\t\t: Promise.resolve().then(() => {\n\t\t\t\tthrow new Error('Module \"' + module + '\" does not exist in container.');\n\t\t\t})\n\t);\n\t__webpack_require__.R = undefined;\n\treturn getScope;\n};\nvar init = (shareScope, initScope) => {\n\tif (!__webpack_require__.S) return;\n\tvar oldScope = __webpack_require__.S[\"default\"];\n\tvar name = \"default\"\n\tif(oldScope && oldScope !== shareScope) throw new Error(\"Container initialization failed as it has already been initialized with a different share scope\");\n\t__webpack_require__.S[name] = shareScope;\n\treturn __webpack_require__.I(name, initScope);\n};\n\n// This exports getters to disallow modifications\n__webpack_require__.d(exports, {\n\tget: () => (get),\n\tinit: () => (init)\n});\n\n//# sourceURL=webpack://vue-app1/container_entry?");
20+
eval("var moduleMap = {\n\t\"./applang\": () => {\n\t\treturn Promise.all([__webpack_require__.e(\"vendors-node_modules_vue-i18n_dist_vue-i18n_esm_js-node_modules_vue_dist_vue_runtime_esm_js\"), __webpack_require__.e(\"src_language_index_js\")]).then(() => (() => ((__webpack_require__(/*! ./src/language/index.js */ \"./src/language/index.js\")))));\n\t},\n\t\"./cloneDeep\": () => {\n\t\treturn Promise.all([__webpack_require__.e(\"vendors-node_modules_lodash_lodash_js\"), __webpack_require__.e(\"src_untils_cloneDeep_js\")]).then(() => (() => ((__webpack_require__(/*! ./src/untils/cloneDeep.js */ \"./src/untils/cloneDeep.js\")))));\n\t},\n\t\"./untils\": () => {\n\t\treturn __webpack_require__.e(\"src_untils_count_js\").then(() => (() => ((__webpack_require__(/*! ./src/untils/count.js */ \"./src/untils/count.js\")))));\n\t},\n\t\"./appOneChildren\": () => {\n\t\treturn __webpack_require__.e(\"src_App_vue\").then(() => (() => ((__webpack_require__(/*! ./src/App.vue */ \"./src/App.vue\")))));\n\t},\n\t\"./appOneIconfont\": () => {\n\t\treturn __webpack_require__.e(\"src_assets_iconfont_iconfont_js\").then(() => (() => ((__webpack_require__(/*! ./src/assets/iconfont/iconfont.js */ \"./src/assets/iconfont/iconfont.js\")))));\n\t},\n\t\"./appOneIconfontCss\": () => {\n\t\treturn __webpack_require__.e(\"src_assets_iconfont_iconfont_css\").then(() => (() => ((__webpack_require__(/*! ./src/assets/iconfont/iconfont.css */ \"./src/assets/iconfont/iconfont.css\")))));\n\t}\n};\nvar get = (module, getScope) => {\n\t__webpack_require__.R = getScope;\n\tgetScope = (\n\t\t__webpack_require__.o(moduleMap, module)\n\t\t\t? moduleMap[module]()\n\t\t\t: Promise.resolve().then(() => {\n\t\t\t\tthrow new Error('Module \"' + module + '\" does not exist in container.');\n\t\t\t})\n\t);\n\t__webpack_require__.R = undefined;\n\treturn getScope;\n};\nvar init = (shareScope, initScope) => {\n\tif (!__webpack_require__.S) return;\n\tvar oldScope = __webpack_require__.S[\"default\"];\n\tvar name = \"default\"\n\tif(oldScope && oldScope !== shareScope) throw new Error(\"Container initialization failed as it has already been initialized with a different share scope\");\n\t__webpack_require__.S[name] = shareScope;\n\treturn __webpack_require__.I(name, initScope);\n};\n\n// This exports getters to disallow modifications\n__webpack_require__.d(exports, {\n\tget: () => (get),\n\tinit: () => (init)\n});\n\n//# sourceURL=webpack://vue-app1/container_entry?");
2121

2222
/***/ })
2323

@@ -100,6 +100,15 @@ eval("var moduleMap = {\n\t\"./applang\": () => {\n\t\treturn Promise.all([__web
100100
/******/ };
101101
/******/ })();
102102
/******/
103+
/******/ /* webpack/runtime/get mini-css chunk filename */
104+
/******/ (() => {
105+
/******/ // This function allow to reference all chunks
106+
/******/ __webpack_require__.miniCssF = (chunkId) => {
107+
/******/ // return url for filenames based on template
108+
/******/ return "css/" + chunkId + ".common.css";
109+
/******/ };
110+
/******/ })();
111+
/******/
103112
/******/ /* webpack/runtime/global */
104113
/******/ (() => {
105114
/******/ __webpack_require__.g = (function() {
@@ -203,6 +212,78 @@ eval("var moduleMap = {\n\t\"./applang\": () => {\n\t\treturn Promise.all([__web
203212
/******/ __webpack_require__.p = scriptUrl;
204213
/******/ })();
205214
/******/
215+
/******/ /* webpack/runtime/css loading */
216+
/******/ (() => {
217+
/******/ var createStylesheet = (chunkId, fullhref, resolve, reject) => {
218+
/******/ var linkTag = document.createElement("link");
219+
/******/
220+
/******/ linkTag.rel = "stylesheet";
221+
/******/ linkTag.type = "text/css";
222+
/******/ var onLinkComplete = (event) => {
223+
/******/ // avoid mem leaks.
224+
/******/ linkTag.onerror = linkTag.onload = null;
225+
/******/ if (event.type === 'load') {
226+
/******/ resolve();
227+
/******/ } else {
228+
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
229+
/******/ var realHref = event && event.target && event.target.href || fullhref;
230+
/******/ var err = new Error("Loading CSS chunk " + chunkId + " failed.\n(" + realHref + ")");
231+
/******/ err.code = "CSS_CHUNK_LOAD_FAILED";
232+
/******/ err.type = errorType;
233+
/******/ err.request = realHref;
234+
/******/ linkTag.parentNode.removeChild(linkTag)
235+
/******/ reject(err);
236+
/******/ }
237+
/******/ }
238+
/******/ linkTag.onerror = linkTag.onload = onLinkComplete;
239+
/******/ linkTag.href = fullhref;
240+
/******/
241+
/******/ document.head.appendChild(linkTag);
242+
/******/ return linkTag;
243+
/******/ };
244+
/******/ var findStylesheet = (href, fullhref) => {
245+
/******/ var existingLinkTags = document.getElementsByTagName("link");
246+
/******/ for(var i = 0; i < existingLinkTags.length; i++) {
247+
/******/ var tag = existingLinkTags[i];
248+
/******/ var dataHref = tag.getAttribute("data-href") || tag.getAttribute("href");
249+
/******/ if(tag.rel === "stylesheet" && (dataHref === href || dataHref === fullhref)) return tag;
250+
/******/ }
251+
/******/ var existingStyleTags = document.getElementsByTagName("style");
252+
/******/ for(var i = 0; i < existingStyleTags.length; i++) {
253+
/******/ var tag = existingStyleTags[i];
254+
/******/ var dataHref = tag.getAttribute("data-href");
255+
/******/ if(dataHref === href || dataHref === fullhref) return tag;
256+
/******/ }
257+
/******/ };
258+
/******/ var loadStylesheet = (chunkId) => {
259+
/******/ return new Promise((resolve, reject) => {
260+
/******/ var href = __webpack_require__.miniCssF(chunkId);
261+
/******/ var fullhref = __webpack_require__.p + href;
262+
/******/ if(findStylesheet(href, fullhref)) return resolve();
263+
/******/ createStylesheet(chunkId, fullhref, resolve, reject);
264+
/******/ });
265+
/******/ }
266+
/******/ // object to store loaded CSS chunks
267+
/******/ var installedCssChunks = {
268+
/******/ "vueAppOne": 0
269+
/******/ };
270+
/******/
271+
/******/ __webpack_require__.f.miniCss = (chunkId, promises) => {
272+
/******/ var cssChunks = {"src_App_vue":1,"src_assets_iconfont_iconfont_css":1};
273+
/******/ if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);
274+
/******/ else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {
275+
/******/ promises.push(installedCssChunks[chunkId] = loadStylesheet(chunkId).then(() => {
276+
/******/ installedCssChunks[chunkId] = 0;
277+
/******/ }, (e) => {
278+
/******/ delete installedCssChunks[chunkId];
279+
/******/ throw e;
280+
/******/ }));
281+
/******/ }
282+
/******/ };
283+
/******/
284+
/******/ // no hmr
285+
/******/ })();
286+
/******/
206287
/******/ /* webpack/runtime/jsonp chunk loading */
207288
/******/ (() => {
208289
/******/ // no baseURI
Loading
Loading

vue-app3/public/mfpApps/app1/deploy/bundle.js

+94-112
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/*!************************************************************************************!*\
2+
!*** css ./node_modules/css-loader/dist/cjs.js!./src/assets/iconfont/iconfont.css ***!
3+
\************************************************************************************/
4+
@font-face {
5+
font-family: "iconfont"; /* Project id 1870567 */
6+
src: url(..//font/iconfont.e8afb1d.woff2) format('woff2'),
7+
url(..//font/iconfont.e697176.woff) format('woff'),
8+
url(..//font/iconfont.08b00db.ttf) format('truetype');
9+
}
10+
11+
.iconfont {
12+
font-family: "iconfont" !important;
13+
font-size: 16px;
14+
font-style: normal;
15+
-webkit-font-smoothing: antialiased;
16+
-moz-osx-font-smoothing: grayscale;
17+
}
18+
19+
.icon-duihua:before {
20+
content: "\e6ba";
21+
}
22+
23+
.icon-diannao:before {
24+
content: "\e6bb";
25+
}
26+
27+
.icon-shouye:before {
28+
content: "\e6bc";
29+
}
30+
31+
.icon-lingdao:before {
32+
content: "\e6bd";
33+
}
34+
35+
.icon-xiezi:before {
36+
content: "\e6be";
37+
}
38+
39+
.icon-zuhe:before {
40+
content: "\e647";
41+
}
42+
43+
.icon-fileplus-fill:before {
44+
content: "\e7c6";
45+
}
46+
47+
.icon-expandalt-fill:before {
48+
content: "\e7e4";
49+
}
50+
51+
.icon-eye-slash:before {
52+
content: "\e7ec";
53+
}
54+
55+
.icon-eye:before {
56+
content: "\e7ed";
57+
}
58+
59+
.icon-reply:before {
60+
content: "\e82f";
61+
}
62+
63+
.icon-share:before {
64+
content: "\e86e";
65+
}
66+
67+
.icon-Directory-tree:before {
68+
content: "\e892";
69+
}
70+
71+
.icon-workflow-copy:before {
72+
content: "\f078";
73+
}
74+
75+
.icon-servicemeshfuwuwangge-copy:before {
76+
content: "\f076";
77+
}
78+
79+
.icon-servicemeshfu-copy-copy:before {
80+
content: "\f077";
81+
}
82+
83+
.icon-dituleiwanggequ-copy:before {
84+
content: "\f072";
85+
}
86+
87+
.icon-fangxingweixuanzhong-copy:before {
88+
content: "\f073";
89+
}
90+
91+
.icon-daqilitiguancex:before {
92+
content: "\e661";
93+
}
94+
95+
.icon-VE:before {
96+
content: "\e666";
97+
}
98+
99+
.icon-customer-info:before {
100+
content: "\e667";
101+
}
102+
103+
.icon-product:before {
104+
content: "\e66c";
105+
}
106+
107+
.icon-distribution:before {
108+
content: "\e671";
109+
}
110+
111+
.icon-litijiankong-copy:before {
112+
content: "\f074";
113+
}
114+
115+
.icon-dulitixi-copy-copy-copy-copy-copy:before {
116+
content: "\f075";
117+
}
118+
119+
.icon-litipouqie:before {
120+
content: "\e603";
121+
}
122+
123+
.icon-rongqi:before {
124+
content: "\e625";
125+
}
126+
127+
.icon-lifangtilitiduomiantifangkuai:before {
128+
content: "\e600";
129+
}
130+
131+
.icon--SearchDatabaseFlat:before {
132+
content: "\f071";
133+
}
134+
135+
136+
/*!****************************************************************************************************************************************************************************************************************************************************************************!*\
137+
!*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/less-loader/dist/cjs.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/children.vue?vue&type=style&index=0&lang=less& ***!
138+
\****************************************************************************************************************************************************************************************************************************************************************************/
139+
.app1-children {
140+
border: 1px solid red;
141+
background: red;
142+
color: #ffff;
143+
}
144+
145+
/*!********************************************************************************************************************************************************************************************************************!*\
146+
!*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/App.vue?vue&type=style&index=0&lang=css& ***!
147+
\********************************************************************************************************************************************************************************************************************/
148+
149+
.vue-app1 {
150+
border: black solid 1px;
151+
padding: 10px;
152+
}
153+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*!****************************************************************************************************************************************************************************************************************************************************************************!*\
2+
!*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/less-loader/dist/cjs.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/children.vue?vue&type=style&index=0&lang=less& ***!
3+
\****************************************************************************************************************************************************************************************************************************************************************************/
4+
.app1-children {
5+
border: 1px solid red;
6+
background: red;
7+
color: #ffff;
8+
}
9+
10+
/*!********************************************************************************************************************************************************************************************************************!*\
11+
!*** css ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/App.vue?vue&type=style&index=0&lang=css& ***!
12+
\********************************************************************************************************************************************************************************************************************/
13+
14+
.vue-app1 {
15+
border: black solid 1px;
16+
padding: 10px;
17+
}
18+

0 commit comments

Comments
 (0)