updated 添加UMD打包方式

This commit is contained in:
PASSER-BY
2022-07-08 01:45:31 +08:00
parent f77273694e
commit 04136643b9
24 changed files with 5634 additions and 1275 deletions

34
webpack.config.js Normal file
View File

@@ -0,0 +1,34 @@
var path = require('path');
var webpack = require('webpack');
const TerserJSPlugin = require('terser-webpack-plugin');
const pkg = require('./package');
var repository = pkg.repository.url.replace(/(.+)(:\/\/.+)\.git$/,'https$2');
var copyright = `${pkg.name} v${pkg.version} - ${pkg.description}
${pkg.homepage}
Copyright (c) 2016-present, ${pkg.author}
Released under the ${pkg.license} License.
${repository}/`;
module.exports = {
entry: './src/relationship.js',
output: {
path: path.resolve(__dirname,'dist'),
filename: 'relationship.min.js',
globalObject: 'this',
library: 'relationship',
libraryTarget: 'umd',
libraryExport:'default'
},
plugins: [
new webpack.BannerPlugin(copyright)
],
optimization: {
minimizer: [
new TerserJSPlugin({
extractComments: false
}),
]
}
};