Giter Club home page Giter Club logo

vue-template's Introduction

纯净的webpack4的vue开发/生产环境项目

仅配置了开发的启动和打包,后续的功能开发自行导入相关依赖

install 下载依赖

npm install

dev

npm run dev
config/index.js 下修改target变量更改开发环境代理请求地址
static/config/index.js更改api接口请求地址
请求接口时使用全局变量window.SITE_CONFIG.baseUrl + url进行拼接

// 代理列表, 是否开启代理通过[./dev.env.js]配置
    proxyTable: devEnv.OPEN_PROXY === false ? {} : {
      '/proxyApi': {
        target: 'http://www.baidu.com:8800',
        changeOrigin: true,
        pathRewrite: {
          '^/proxyApi': '/'
        }
      }
    },

build

使用static/config/index-${evn}.js 对应打包配置文件下的 baseUrl请求地址
prod(生产环境打包)
npm run build
dev(开发环境打包)
npm run build --dev
test(测试环境打包)
npm run build --test

打包后的项目结构

├─index.html  
│  
├─(版本号)  
│     └─static  
│          ├─css  
│          │   └─3.css  
│          │   └─app.css  
│          │      
│          ├─img  
│          │   └─favicon.ico  
│          │      
│          └─js  
│             ├─3.js  
│             ├─4.js  
│             ├─app.js  
│             ├─manifest.js  
│             └─vendor.js  
│              
└─config  
      └─index.js  

版本支持
node < 11
当前打包工具gulpfile引入版本为3.9,最高只支持node11,使用更高的node版本需自行升级gulpfile并重写gulpfile.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.