Browse Source

调整相关依赖

lyking90 2 years ago
parent
commit
d800649fb0
7 changed files with 26 additions and 27 deletions
  1. 2 2
      .eslintrc.js
  2. 9 14
      package.json
  3. 2 2
      plopfile.js
  4. 1 1
      src/layout/components/Sidebar/Item.vue
  5. 2 2
      src/main.js
  6. 1 1
      src/utils/index.js
  7. 9 5
      vite.config.js

+ 2 - 2
.eslintrc.js

@@ -1,7 +1,7 @@
 module.exports = {
   root: true,
   parserOptions: {
-    parser: 'babel-eslint',
+    // parser: 'babel-eslint',
     sourceType: 'module'
   },
   env: {
@@ -190,7 +190,7 @@ module.exports = {
     'wrap-iife': [2, 'any'],
     'yield-star-spacing': [2, 'both'],
     'yoda': [2, 'never'],
-    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
+    // 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
     'object-curly-spacing': [2, 'always', {
       objectsInObjects: false
     }],

+ 9 - 14
package.json

@@ -5,9 +5,7 @@
   "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint",
   "author": "Pan <panfree23@gmail.com>",
   "scripts": {
-    "serve": "vite",
-    "serve:dev": "vite --mode development",
-    "serve:prod": "vite --mode production",
+    "dev": "vite",
     "build": "vite build",
     "build:dev": "vite build --mode development",
     "build:prod": "vite build --mode production",
@@ -17,12 +15,8 @@
     "@grapecity/ar-designer": "^16.1.1",
     "@grapecity/ar-viewer": "^16.1.1",
     "@riophae/vue-treeselect": "^0.1.0",
-    "@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
     "async": "^2.6.2",
     "axios": "0.18.0",
-    "babel-plugin-syntax-dynamic-import": "^6.18.0",
-    "babel-polyfill": "^6.26.0",
-    "babel-preset-es2015": "^6.24.1",
     "bignumber.js": "^9.0.0",
     "connect": "^3.6.6",
     "crypto-js": "^3.3.0",
@@ -62,17 +56,18 @@
   },
   "devDependencies": {
     "@vitejs/plugin-legacy": "^1.6.4",
-    "@vitejs/plugin-vue-jsx": "^1.3.10",
     "autoprefixer": "9.5.1",
     "cross-env": "5.2.0",
-    "eslint": "^5.16.0",
-    "eslint-friendly-formatter": "4.0.1",
-    "eslint-loader": "2.1.2",
-    "eslint-plugin-html": "^5.0.3",
-    "eslint-plugin-vue": "5.2.2",
+    "eslint": "^8.15.0",
+    "eslint-config-prettier": "^8.5.0",
+    "eslint-plugin-html": "^6.2.0",
+    "eslint-plugin-prettier": "^4.0.0",
+    "eslint-plugin-vue": "^9.0.1",
     "plop": "^3.0.5",
+    "postcss": "^8.4.14",
     "sass": "~1.32.6",
     "vite-plugin-compression": "^0.4.0",
+    "vite-plugin-eslint": "^1.6.1",
     "vite-plugin-vue2": "^1.9.2",
     "vue-template-compiler": "^2.6.14"
   },
@@ -85,4 +80,4 @@
     "last 2 versions",
     "not ie <= 8"
   ]
-}
+}

+ 2 - 2
plopfile.js

@@ -1,8 +1,8 @@
 // plop 的入口文件
 // 需要导出一个函数,函数接收一个plop对象,用于创建生成器任务
 
-const path = require('path')
-const fs = require('fs')
+import path from 'path'
+import fs from 'fs'
 
 function getFolder(path) {
   let components = []

+ 1 - 1
src/layout/components/Sidebar/Item.vue

@@ -1,4 +1,4 @@
-<script>
+<script lang='jsx'>
 export default {
   name: 'MenuItem',
   functional: true,

+ 2 - 2
src/main.js

@@ -41,7 +41,7 @@ import VXETablePluginElement from 'vxe-table-plugin-element'
 import 'vxe-table-plugin-element/dist/style.css'
 import VXETablePluginRenderer from 'vxe-table-plugin-renderer-yunt'
 import 'vxe-table-plugin-renderer-yunt/dist/style.css'
-
+import VueMoment from 'vue-moment'
 Vue.use(permission)
 
 Vue.use(ELEMENT, {
@@ -76,7 +76,7 @@ VXETable.use(VXETablePluginRenderer)
 
 Vue.component('VueCtkDateTimePicker', VueCtkDateTimePicker)
 
-Vue.use(require('vue-moment'))
+Vue.use(VueMoment)
 Vue.config.productionTip = false
 
 // 在原型链中注册,然后再需要引用的页面就可以这样拿到--调用方法::this.$pushRouterTo()等

+ 1 - 1
src/utils/index.js

@@ -2,7 +2,7 @@ import VXETable from 'vxe-table-yunti-3'
 import {
   Message
 } from 'element-ui' // eslint-disable-line
-const BigNumber = require('bignumber.js')
+import BigNumber from 'bignumber.js'
 const BN_Format = {
   prefix: '',
   groupSize: 0,

+ 9 - 5
vite.config.js

@@ -1,20 +1,24 @@
-import { defineConfig } from 'vite'
+import { defineConfig, loadEnv } from 'vite'
 import legacy from '@vitejs/plugin-legacy'
 import { createVuePlugin } from 'vite-plugin-vue2'
 import viteCompression from 'vite-plugin-compression'
 import path from 'path'
-import vueJsx from '@vitejs/plugin-vue-jsx'
+// import eslintPlugin from 'vite-plugin-eslint'
 
 const HOST = '0.0.0.0'
 const REPLACEMENT = `${path.resolve(__dirname, './src')}/`
 
-export default (/** if you want to use mode : { mode }*/) => {
+export default ({ mode }) => {
+  const env = loadEnv(mode, process.cwd())
   return defineConfig({
     base: './',
     server: {
       host: HOST,
       port: process.env.PORT
     },
+    define: {
+      'process.env': { ...env }
+    },
     resolve: {
       alias: [
         {
@@ -33,12 +37,12 @@ export default (/** if you want to use mode : { mode }*/) => {
       createVuePlugin({
         jsx: true
       }),
+      // eslintPlugin(),
       legacy({
         targets: ['ie >= 11'],
         additionalLegacyPolyfills: ['regenerator-runtime/runtime']
       }),
-      viteCompression(),
-      vueJsx()
+      viteCompression()
     ]
   })
 }