Compare commits

..

5 Commits

6 changed files with 55 additions and 14 deletions

View File

@ -1,5 +1,8 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
plugins: [
'@babel/plugin-syntax-dynamic-import'
]
}

View File

@ -20,6 +20,7 @@
"vue-table-with-tree-grid": "^0.2.4"
},
"devDependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@vue/cli-plugin-babel": "~4.4.0",
"@vue/cli-plugin-eslint": "~4.4.0",
"@vue/cli-plugin-router": "~4.4.0",

View File

@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<% if(htmlWebpackPlugin.options.isProd){ %>
<link href="https://cdn.staticfile.org/element-ui/2.13.2/theme-chalk/index.css" rel="stylesheet">
<link href="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.css" rel="stylesheet">
<link href="https://cdn.staticfile.org/quill/1.3.7/quill.core.min.css" rel="stylesheet">
@ -20,7 +21,8 @@
<script src="https://cdn.staticfile.org/element-ui/2.13.2/index.js"></script>
<script src="https://cdn.staticfile.org/quill/1.3.7/quill.min.js"></script>
<script src="vue-quill-editor.js"></script>
<title><%= htmlWebpackPlugin.options.title %></title>
<% } %>
<title><%= htmlWebpackPlugin.options.isProd ? '' :'dev -' %> 后台管理系统</title>
</head>
<body>
<noscript>

View File

@ -1,17 +1,35 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/Login'
import Home from '../components/Home'
import welcome from '../components/welcome'
import users from '../components/users/users'
import access from '../components/access/access'
import roles from '../components/access/roles'
import categories from '../components/goods/categories'
import params from '../components/goods/params'
import goods from '../components/goods/goods'
import goodsEdit from '../components/goods/edit'
import order from '../components/order/order'
import report from '../components/report/report'
// import Login from '../components/Login'
const Login = () => import(/* webpackChunkName: "login-home-welcome" */ '../components/Login')
// import Home from '../components/Home'
const Home = () => import(/* webpackChunkName: "login-home-welcome" */ '../components/Home')
// import welcome from '../components/welcome'
const welcome = () => import(/* webpackChunkName: "login-home-welcome" */ '../components/welcome')
// import users from '../components/users/users'
// import access from '../components/access/access'
// import roles from '../components/access/roles'
const users = () => import(/* webpackChunkName: "login-home-users" */ '../components/welcome')
const access = () => import(/* webpackChunkName: "login-home-users" */ '../components/access/access')
const roles = () => import(/* webpackChunkName: "login-home-users" */ '../components/access/roles')
// import categories from '../components/goods/categories'
// import params from '../components/goods/params'
// import goods from '../components/goods/goods'
// import goodsEdit from '../components/goods/edit'
const categories = () => import(/* webpackChunkName: "login-home-goods" */ '../components/goods/categories')
const params = () => import(/* webpackChunkName: "login-home-goods" */ '../components/goods/params')
const goods = () => import(/* webpackChunkName: "login-home-goods" */ '../components/goods/goods')
const goodsEdit = () => import(/* webpackChunkName: "login-home-goods" */ '../components/goods/edit')
// import order from '../components/order/order'
// import report from '../components/report/report'
const order = () => import(/* webpackChunkName: "login-home-order" */ '../components/order/order')
const report = () => import(/* webpackChunkName: "login-home-order" */ '../components/report/report')
Vue.use(VueRouter)

View File

@ -20,10 +20,20 @@ module.exports = {
nprogress: 'NProgress',
'vue-quill-editor': 'VueQuillEditor'
})
config.plugin('html').tap(args => {
args[0].isProd = true
return args
})
})
// 设置开发环境的main.js
config.when(process.env.NODE_ENV === 'development', config => {
config.entry('add').clear().add('./src/main-dev.js')
config.plugin('html').tap(args => {
args[0].isProd = false
return args
})
})
}
}

View File

@ -377,13 +377,20 @@
dependencies:
"@babel/helper-plugin-utils" "^7.10.1"
"@babel/plugin-syntax-dynamic-import@^7.8.0", "@babel/plugin-syntax-dynamic-import@^7.8.3":
"@babel/plugin-syntax-dynamic-import@^7.8.0":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3"
integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"
"@babel/plugin-syntax-dynamic-import@^7.8.3":
version "7.8.3"
resolved "https://registry.npm.taobao.org/@babel/plugin-syntax-dynamic-import/download/@babel/plugin-syntax-dynamic-import-7.8.3.tgz?cache=0&sync_timestamp=1578950368021&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-syntax-dynamic-import%2Fdownload%2F%40babel%2Fplugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3"
integrity sha1-Yr+Ysto80h1iYVT8lu5bPLaOrLM=
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"
"@babel/plugin-syntax-json-strings@^7.8.0":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a"