Skip to content

Latest commit

 

History

History
26 lines (26 loc) · 798 Bytes

File metadata and controls

26 lines (26 loc) · 798 Bytes

第三方库打包

const path = require('path');
module.exports = {
  mode: 'production',
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, './dist'),
    externals: ['lodash'],
    fileName: 'library.js',
    library: 'library', // 代表可以通过index.html方式引入
    libraryTarget: 'umd', // 支持require方式引入
  }
}
  • vue-cli3方式
package.json
"build": "vue-cli-service build --target lib --name adSdk ./src/sdk/index.js",