zoukankan      html  css  js  c++  java
  • 项目优化 2

    module.exports = {
      chainWebpack: config => {
        // 发布模式
        config.when(process.env.NODE_ENV === 'production', config => {
          config
            .entry('app')
            .clear()
            .add('./src/main-prod.js')

          config.set('externals', {
            vue: 'Vue',
            'vue-router': 'VueRouter',
            axios: 'axios',
            lodash: '_',
            echarts: 'echarts',
            nprogress: 'NProgress',
            'vue-quill-editor': 'VueQuillEditor'
          })

          config.plugin('html').tap(args => {
            args[0].isProd = true
            return args
          })
        })

        // 开发模式
        config.when(process.env.NODE_ENV === 'development', config => {
          config
            .entry('app')
            .clear()
            .add('./src/main-dev.js')

          config.plugin('html').tap(args => {
            args[0].isProd = false
            return args
          })
        })
      }
    }
     

     npm install --save-dev @babel/plugin-syntax-dynamic-import

    // import Login from './components/Login.vue' 
    const Login = () =>
        import ( /* webpackChunkName:"login_home_welcode" */ './components/Login.vue')
        // import Home from './components/Home.vue'
    const Home = () =>
        import ( /* webpackChunkName:"login_home_welcode" */ './components/Home.vue')
        // import Welcome from './components/Welcome.vue'
    const Welcome = () =>
        import ( /* webpackChunkName:"login_home_welcode" */ './components/Welcome.vue')


    // import Users from './components/user/Users.vue'
    const Users = () =>
        import ( /* webpackChunkName:"Users_Rights_Roles" */ './components/user/Users.vue')
        // import Rights from './components/power/Rights.vue'
    const Rights = () =>
        import ( /* webpackChunkName:"Users_Rights_Roles" */ './components/power/Rights.vue')
        // import Roles from './components/power/Roles.vue'
    const Roles = () =>
        import ( /* webpackChunkName:"Users_Rights_Roles" */ './components/power/Roles.vue')
     
  • 相关阅读:
    MyBatis高级查询 存储过程
    MyBatis高级查询 一对多映射
    第20章-使用JMX管理Spring Bean
    第19章-使用Spring发送Email
    第18章-使用WebSocket和STOMP实现消息功能
    第17章-Spring消息
    第16章-使用Spring MVC创建REST API
    第15章-使用远程服务
    基于IKAnalyzer搭建分词服务
    第08章-使用Spring Web Flow
  • 原文地址:https://www.cnblogs.com/ericblog1992/p/13186493.html
Copyright © 2011-2022 走看看