1.3.0 • Published 4 years ago

lib-test-sunjianfei v1.3.0

Weekly downloads
40
License
-
Repository
-
Last release
4 years ago

开发

目录

examples是示例工程,在开发过程中,用于调用模块化库中的脚本或者组件,入口为examples/main.js

packages是模块化库的源码,入口为packages/index.js;

其他文件或文件夹为vue工程默认,未做新增或者修改。

基础配置:

入口配置:

module.exports = {

  publicPath: process.env.NODE_ENV === "development" ? "/" : "./", // 设置基本的URL

  pages: {
    index: {
      // page 的入口
      entry: process.env.NODE_ENV === "development" ? "./examples/main.js" : "./packages/index.js",
      // 模板来源
      template: 'public/index.html',
      // 在 dist/index.html 的输出
      filename: 'index.html',
    }
  },
  devServer: {
    port: 8080,
    hot: true,
    clientLogLevel: 'info',
     proxy: {
        "/": {
          target: "",
          changeOrigin: true,
          pathRewrite: {}
        }
     }
  },

}

打包配置

"name": "lib-test-sunjianfei",//库名称
"version": "0.5.0",
"description": "测试vue库开发",
"private": false,//发布到npm必须设置为 false
"main": "dist/testlib.umd.js",//打包后的入口,设置为打包后的dist中的入口文件即可。

打包

在package.json中,新增lib项,用于打包库文件。

"scripts": {
  "serve": "vue-cli-service serve",
  "build": "vue-cli-service build",
  "lib": "vue-cli-service build --target lib --name testlib --dest dist packages/index.js",
  "lint": "vue-cli-service lint"
},

执行脚本 npm run lib 即可打包库文件。

发布

使用

vue-lib

Project setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Run your tests

npm run test

Lints and fixes files

npm run lint

Customize configuration

See Configuration Reference.

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

1.3.0

4 years ago

0.9.0

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.3.0

4 years ago

0.5.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago