UNPKG

mx-h5-jsbridge

Version:

支持H5和iOS/Android/Harmony进行双向通信,H5 和原生通讯只需一套代码

43 lines (39 loc) 1.08 kB
const pkg = require('./package.json'); const path = require('path'); const webpack = require('webpack'); const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); const production = process.env.NODE_ENV === 'production' || false; const banner = ''; module.exports = { entry: './src/jsBridge.js', mode: 'production', output: { filename: production ? 'jsBridge.min.js' : 'jsBridge.js', path: path.resolve(__dirname, 'dist'), library: 'JSBridge', libraryTarget: 'umd', globalObject: 'this' }, module: { rules: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' } ] }, optimization: { minimize: production, minimizer: [ new UglifyJSPlugin({ parallel: require('os').cpus().length, uglifyOptions: { ie8: false, keep_fnames: false, output: { beautify: false, comments: (node, { value, type }) => type == 'comment2' && value.startsWith('!') } } }) ] }, plugins: [new webpack.BannerPlugin({ banner })] };