imatrix-ui 2.8.97-dw-tmp29 → 2.8.97-dw-tmp31

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.
Files changed (39) hide show
  1. package/lib/breadcrumb.js +1 -136
  2. package/lib/department-tree-inline.js +1 -136
  3. package/lib/department-tree.js +1 -136
  4. package/lib/department-user-tree-inline.js +1 -136
  5. package/lib/department-user-tree.js +1 -136
  6. package/lib/dynamic-source-select.js +1 -136
  7. package/lib/fs-preview.js +1 -136
  8. package/lib/fs-upload-list.js +1 -136
  9. package/lib/fs-upload.js +1 -136
  10. package/lib/hamburger.js +1 -136
  11. package/lib/index.js +312 -312
  12. package/lib/index.js.gz +0 -0
  13. package/lib/multipart-upload.js +1 -136
  14. package/lib/organization-input.js +1 -136
  15. package/lib/plugins.js +250 -250
  16. package/lib/plugins.js.gz +0 -0
  17. package/lib/remove-department.js +1 -136
  18. package/lib/remove-user.js +1 -136
  19. package/lib/remove-workgroup.js +1 -136
  20. package/lib/rich-editor.js +1 -136
  21. package/lib/scan-code-input.js +1 -136
  22. package/lib/secret-info.js +1 -136
  23. package/lib/super-grid.js +1 -136
  24. package/lib/super-nine-grid.js +1 -136
  25. package/lib/svg-icon.js +1 -136
  26. package/lib/valid-code.js +1 -136
  27. package/lib/workflow-button.js +1 -136
  28. package/lib/workflow-history-list.js +1 -136
  29. package/lib/workgroup-tree-inline.js +1 -136
  30. package/lib/workgroup-tree.js +1 -136
  31. package/lib/workgroup-user-tree-inline.js +1 -136
  32. package/lib/workgroup-user-tree.js +1 -136
  33. package/lib/year-range-picker.js +1 -136
  34. package/package.json +3 -2
  35. package/packages/department-tree/src/department-tree.vue +1 -1
  36. package/packages/index.js +1 -1
  37. package/src/index.js +121 -0
  38. package/webpack.commonjs.js +60 -0
  39. package/webpack.components.js +8 -2
@@ -1,136 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["imatrix-ui"] = factory();
8
- else
9
- root["imatrix-ui"] = factory();
10
- })(window, function() {
11
- return /******/ (function(modules) { // webpackBootstrap
12
- /******/ // The module cache
13
- /******/ var installedModules = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function __webpack_require__(moduleId) {
17
- /******/
18
- /******/ // Check if module is in cache
19
- /******/ if(installedModules[moduleId]) {
20
- /******/ return installedModules[moduleId].exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var module = installedModules[moduleId] = {
24
- /******/ i: moduleId,
25
- /******/ l: false,
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
- /******/
32
- /******/ // Flag the module as loaded
33
- /******/ module.l = true;
34
- /******/
35
- /******/ // Return the exports of the module
36
- /******/ return module.exports;
37
- /******/ }
38
- /******/
39
- /******/
40
- /******/ // expose the modules object (__webpack_modules__)
41
- /******/ __webpack_require__.m = modules;
42
- /******/
43
- /******/ // expose the module cache
44
- /******/ __webpack_require__.c = installedModules;
45
- /******/
46
- /******/ // define getter function for harmony exports
47
- /******/ __webpack_require__.d = function(exports, name, getter) {
48
- /******/ if(!__webpack_require__.o(exports, name)) {
49
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50
- /******/ }
51
- /******/ };
52
- /******/
53
- /******/ // define __esModule on exports
54
- /******/ __webpack_require__.r = function(exports) {
55
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
- /******/ }
58
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
59
- /******/ };
60
- /******/
61
- /******/ // create a fake namespace object
62
- /******/ // mode & 1: value is a module id, require it
63
- /******/ // mode & 2: merge all properties of value into the ns
64
- /******/ // mode & 4: return value when already ns object
65
- /******/ // mode & 8|1: behave like require
66
- /******/ __webpack_require__.t = function(value, mode) {
67
- /******/ if(mode & 1) value = __webpack_require__(value);
68
- /******/ if(mode & 8) return value;
69
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70
- /******/ var ns = Object.create(null);
71
- /******/ __webpack_require__.r(ns);
72
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74
- /******/ return ns;
75
- /******/ };
76
- /******/
77
- /******/ // getDefaultExport function for compatibility with non-harmony modules
78
- /******/ __webpack_require__.n = function(module) {
79
- /******/ var getter = module && module.__esModule ?
80
- /******/ function getDefault() { return module['default']; } :
81
- /******/ function getModuleExports() { return module; };
82
- /******/ __webpack_require__.d(getter, 'a', getter);
83
- /******/ return getter;
84
- /******/ };
85
- /******/
86
- /******/ // Object.prototype.hasOwnProperty.call
87
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88
- /******/
89
- /******/ // __webpack_public_path__
90
- /******/ __webpack_require__.p = "";
91
- /******/
92
- /******/
93
- /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = "./packages/year-range-picker/index.js");
95
- /******/ })
96
- /************************************************************************/
97
- /******/ ({
98
-
99
- /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
100
- /*!********************************************************************!*\
101
- !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
102
- \********************************************************************/
103
- /*! exports provided: default */
104
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
105
-
106
- "use strict";
107
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return normalizeComponent; });\n/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nfunction normalizeComponent(\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier /* server only */,\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options =\n typeof scriptExports === 'function' ? scriptExports.options : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) {\n // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () {\n injectStyles.call(\n this,\n (options.functional ? this.parent : this).$root.$options.shadowRoot\n )\n }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functional component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection(h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing ? [].concat(existing, hook) : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n\n\n//# sourceURL=webpack://imatrix-ui/./node_modules/vue-loader/lib/runtime/componentNormalizer.js?");
108
-
109
- /***/ }),
110
-
111
- /***/ "./packages/year-range-picker/index.js":
112
- /*!*********************************************!*\
113
- !*** ./packages/year-range-picker/index.js ***!
114
- \*********************************************/
115
- /*! exports provided: default */
116
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
117
-
118
- "use strict";
119
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _src_year_range_picker_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/year-range-picker.vue */ \"./packages/year-range-picker/src/year-range-picker.vue\");\n\r\n_src_year_range_picker_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].install = function(Vue) {\r\n Vue.component(_src_year_range_picker_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].name, _src_year_range_picker_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"])\r\n}\r\n\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (_src_year_range_picker_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\r\n\n\n//# sourceURL=webpack://imatrix-ui/./packages/year-range-picker/index.js?");
120
-
121
- /***/ }),
122
-
123
- /***/ "./packages/year-range-picker/src/year-range-picker.vue":
124
- /*!**************************************************************!*\
125
- !*** ./packages/year-range-picker/src/year-range-picker.vue ***!
126
- \**************************************************************/
127
- /*! exports provided: default */
128
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
129
-
130
- "use strict";
131
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ \"./node_modules/vue-loader/lib/runtime/componentNormalizer.js\");\nvar render, staticRenderFns\nvar script = {}\n\n\n/* normalize component */\n\nvar component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\ncomponent.options.__file = \"packages/year-range-picker/src/year-range-picker.vue\"\n/* harmony default export */ __webpack_exports__[\"default\"] = (component.exports);\n\n//# sourceURL=webpack://imatrix-ui/./packages/year-range-picker/src/year-range-picker.vue?");
132
-
133
- /***/ })
134
-
135
- /******/ });
136
- });
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SuperUI=t():e.SuperUI=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=132)}({1:function(e,t,n){"use strict";function r(e,t,n,r,o,i,u,c){var f,a="function"==typeof e?e.options:e;if(t&&(a.render=t,a.staticRenderFns=n,a._compiled=!0),r&&(a.functional=!0),i&&(a._scopeId="data-v-"+i),u?(f=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(u)},a._ssrRegister=f):o&&(f=c?function(){o.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:o),f)if(a.functional){a._injectStyles=f;var s=a.render;a.render=function(e,t){return f.call(t),s(e,t)}}else{var l=a.beforeCreate;a.beforeCreate=l?[].concat(l,f):[f]}return{exports:e,options:a}}n.d(t,"a",(function(){return r}))},132:function(e,t,n){"use strict";n.r(t);var r=n(1),o=Object(r.a)({},void 0,void 0,!1,null,null,null);o.options.__file="packages/year-range-picker/src/year-range-picker.vue";var i=o.exports;i.install=function(e){e.component(i.name,i)};t.default=i}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imatrix-ui",
3
- "version": "2.8.97-dw-tmp29",
3
+ "version": "2.8.97-dw-tmp31",
4
4
  "description": "前端组件库:表格、表单、组织结构树等",
5
5
  "main": "lib/super-ui.umd.min.js",
6
6
  "private": false,
@@ -11,7 +11,8 @@
11
11
  "lint": "vue-cli-service lint",
12
12
  "test:e2e": "vue-cli-service test:e2e",
13
13
  "test:unit": "vue-cli-service test:unit",
14
- "webpack": "webpack --config ./webpack.components.js"
14
+ "webpack": "webpack --config ./webpack.components.js",
15
+ "buildJs": "webpack --config ./webpack.commonjs.js"
15
16
  },
16
17
  "dependencies": {
17
18
  "@tinymce/tinymce-vue": "^3.2.4",
@@ -35,7 +35,7 @@
35
35
  </div>
36
36
  </template>
37
37
  <script>
38
- import InlineDepartmentTree from '../../department-tree-inline.vue'
38
+ import InlineDepartmentTree from '../../department-tree-inline/src/department-tree-inline.vue'
39
39
  export default {
40
40
  name: 'DepartmentTree',
41
41
  components: {
package/packages/index.js CHANGED
@@ -16,7 +16,7 @@ import WorkflowHistoryList from './workflow-history-list'
16
16
  import PreventReclick from './directives/prevent-reclick'
17
17
  // import exportPlugin from './export-data/index'
18
18
  import ValidCode from './valid-code'
19
- import customPlugin from './../packages/plugins/index'
19
+ import customPlugin from './plugins/index'
20
20
  import RemoveUser from './remove-user'
21
21
  import RemoveDepartment from './remove-department'
22
22
  import RemoveWorkgroup from './remove-workgroup'
package/src/index.js ADDED
@@ -0,0 +1,121 @@
1
+ // 依次导入组件库的各个组件
2
+ import Breadcrumb from '../packages/breadcrumb'
3
+ import DepartmentTree from '../packages/department-tree'
4
+ import Hamburger from '../packages/hamburger'
5
+ import SvgIcon from '../packages/svg-icon'
6
+ import SuperGrid from '../packages/super-grid'
7
+ import DepartmentUserTree from '../packages/department-user-tree'
8
+ import WorkgroupTree from '../packages/workgroup-tree'
9
+ import WorkgroupUserTree from '../packages/workgroup-user-tree'
10
+ import InlineDepartmentTree from '../packages/department-tree-inline'
11
+ import InlineDepartmentUserTree from '../packages/department-user-tree-inline'
12
+ import InlineWorkgroupTree from '../packages/workgroup-tree-inline'
13
+ import InlineWorkgroupUserTree from '../packages/workgroup-user-tree-inline'
14
+ import WorkflowButton from '../packages/workflow-button'
15
+ import WorkflowHistoryList from '../packages/workflow-history-list'
16
+ import PreventReclick from '../packages/directives/prevent-reclick'
17
+ // import exportPlugin from '../packages/export-data/index'
18
+ import ValidCode from '../packages/valid-code'
19
+ import customPlugin from '../packages/plugins/index'
20
+ import RemoveUser from '../packages/remove-user'
21
+ import RemoveDepartment from '../packages/remove-department'
22
+ import RemoveWorkgroup from '../packages/remove-workgroup'
23
+ import OrganizationInput from '../packages/organization-input'
24
+ import SuperNineGrid from '../packages/super-nine-grid'
25
+ import DynamicSourceSelect from '../packages/dynamic-source-select'
26
+ import FsUpload from '../packages/fs-upload'
27
+ import ScanCodeInput from '../packages/scan-code-input'
28
+ import FsPreview from '../packages/fs-preview'
29
+ import FsUploadList from '../packages/fs-upload-list'
30
+ import { openPage } from './utils/jump-page-utils'
31
+ import YearRangePicker from '../packages/year-range-picker'
32
+ import MultipartUpload from '../packages/multipart-upload'
33
+ import RichEditor from '../packages/rich-editor'
34
+ import SecretInfo from '../packages/secret-info'
35
+ // 将所有组件都存储起来,方便后续统一注册
36
+ const components = [
37
+ Breadcrumb,
38
+ DepartmentTree,
39
+ Hamburger,
40
+ SvgIcon,
41
+ SuperGrid,
42
+ DepartmentUserTree,
43
+ WorkgroupTree,
44
+ WorkgroupUserTree,
45
+ InlineDepartmentTree,
46
+ InlineDepartmentUserTree,
47
+ InlineWorkgroupTree,
48
+ InlineWorkgroupUserTree,
49
+ WorkflowButton,
50
+ WorkflowHistoryList,
51
+ ValidCode,
52
+ RemoveUser,
53
+ RemoveDepartment,
54
+ RemoveWorkgroup,
55
+ OrganizationInput,
56
+ SuperNineGrid,
57
+ DynamicSourceSelect,
58
+ FsUpload,
59
+ ScanCodeInput,
60
+ FsPreview,
61
+ FsUploadList,
62
+ YearRangePicker,
63
+ MultipartUpload,
64
+ RichEditor,
65
+ SecretInfo
66
+ ]
67
+
68
+ // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
69
+ const install = function(Vue) {
70
+ Vue.directive('prevent-reclick', PreventReclick)
71
+ Vue.use(customPlugin)
72
+ if (install.installed) return
73
+ // components.map(component => Vue.component(component.name, component))
74
+ // components.forEach(component => {
75
+ // Vue.component(component.name, component)
76
+ // })
77
+ // 将弹出页面方法注册到window对象上
78
+ window['$plateform_openPage'] = openPage
79
+ }
80
+
81
+ // 判断是否是直接引入vue的js文件,即全局引用可自动安装所有组件
82
+ if (typeof window !== 'undefined' && window.Vue) {
83
+ install(window.Vue)
84
+ }
85
+ // 按需引入
86
+ export {
87
+ Breadcrumb,
88
+ DepartmentTree,
89
+ Hamburger,
90
+ SvgIcon,
91
+ SuperGrid,
92
+ DepartmentUserTree,
93
+ WorkgroupTree,
94
+ WorkgroupUserTree,
95
+ InlineDepartmentTree,
96
+ InlineDepartmentUserTree,
97
+ InlineWorkgroupTree,
98
+ InlineWorkgroupUserTree,
99
+ WorkflowButton,
100
+ WorkflowHistoryList,
101
+ ValidCode,
102
+ RemoveUser,
103
+ RemoveDepartment,
104
+ RemoveWorkgroup,
105
+ OrganizationInput,
106
+ SuperNineGrid,
107
+ DynamicSourceSelect,
108
+ FsUpload,
109
+ ScanCodeInput,
110
+ FsPreview,
111
+ FsUploadList,
112
+ YearRangePicker,
113
+ MultipartUpload,
114
+ RichEditor,
115
+ SecretInfo
116
+ }
117
+
118
+ export default {
119
+ // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
120
+ install
121
+ }
@@ -0,0 +1,60 @@
1
+
2
+ // 引入path,构造绝对路径
3
+ const path = require('path') // node自带
4
+ // 动态填写组件的入口文件的名字,需要遍历src文件夹,因此需要通过内置库glob去遍历文件夹
5
+ const glob = require('glob') // node自带的库
6
+ const CompressionWebpackPlugin = require('compression-webpack-plugin')
7
+
8
+ // 设置入口文件,因为每个组件都有自己的入口,所以需要用对象来声明
9
+ const list = {
10
+ // card: "./components/lib/card/index.js",
11
+ }
12
+ // 输入参数:1.配置组件文件夹的目录,2.配置多入口文件的配置对象
13
+ async function makeList(dirPash, list) {
14
+ const files = glob.sync(`${dirPash}/**/*.js`) // 接受遍历到的文件,主要拿到的是每个组件下的index.js文件
15
+ // console.log('files',files) //终端输出完整的文件名,现在想拆分文件名,拿到组件的名字
16
+ // 遍历files
17
+ for (const file of files) {
18
+ const component = file.split(/[/.]/)[1] // 拿到组件名
19
+ // console.log('component:', component)
20
+ list[component] = `./${file}`
21
+ }
22
+ // console.log(list);
23
+ }
24
+ // 执行函数
25
+ makeList('src', list)
26
+ // function resolve(dir) {
27
+ // return path.join(__dirname, './', dir)
28
+ // }
29
+
30
+ // 导出对象给webpack
31
+ module.exports = {
32
+ // 自定义的字段
33
+ entry: list, // 打包的入口文件,每个组件都有自己的入口
34
+ mode: 'development', // 设置为开发模式
35
+ output: {
36
+ // 输出配置
37
+ filename: 'imatrix-ui.js', // name即组件名,最后会得到card.umd.js
38
+ path: path.join(__dirname, 'lib') // 必须用绝对路径,否则打包时报错
39
+ },
40
+ plugins: [
41
+ new CompressionWebpackPlugin({
42
+ test: /\.(js|css)(\?.*)?$/i, // 需要压缩的文件正则
43
+ threshold: 10240, // 文件大小大于这个值时启用压缩
44
+ deleteOriginalAssets: true// 压缩后删除原文件
45
+ })
46
+ ],
47
+ module: {
48
+ // 配置vue-loader
49
+ rules: [{
50
+ // 告诉webpack对什么文件使用什么rule
51
+ test: /\.js$/,
52
+ use: [
53
+ {
54
+ loader: 'vue-loader'
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ }
@@ -1,4 +1,5 @@
1
1
 
2
+ const CompressionWebpackPlugin = require('compression-webpack-plugin')
2
3
  // 引入vue-loader
3
4
  const { VueLoaderPlugin } = require('vue-loader')
4
5
  // 引入path,构造绝对路径
@@ -32,15 +33,20 @@ makeList('packages', list)
32
33
  module.exports = {
33
34
  // 自定义的字段
34
35
  entry: list, // 打包的入口文件,每个组件都有自己的入口
35
- mode: 'development', // 设置为开发模式
36
+ // mode: 'development', // 设置为开发模式
36
37
  output: {
37
38
  // 输出配置
38
39
  filename: '[name].js', // name即组件名,最后会得到card.umd.js
39
40
  path: path.join(__dirname, 'lib'), // 必须用绝对路径,否则打包时报错
40
- library: 'imatrix-ui',
41
+ library: 'SuperUI',
41
42
  libraryTarget: 'umd'
42
43
  },
43
44
  plugins: [
45
+ new CompressionWebpackPlugin({
46
+ test: /\.(js|css)(\?.*)?$/i, // 需要压缩的文件正则
47
+ threshold: 10240, // 文件大小大于这个值时启用压缩
48
+ deleteOriginalAssets: true// 压缩后删除原文件
49
+ }),
44
50
  // 配置loader,对文件进行预处理
45
51
  // 安装vue-loader:npm i vue-loader -D
46
52
  // 引入vue-loader