UNPKG

@jmarvinr/tree

Version:

a lightweight tree widget, compatible with originaljs/react/vue, 9.6kb size for tree.min.js&tree.min.css without gzip.

85 lines (83 loc) 2.48 kB
const webpack = require('webpack'); const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') .BundleAnalyzerPlugin; module.exports = { mode: 'none', devtool: 'source-map', entry: { tree: './src/index.js', 'tree.min': './src/index.js', }, output: { filename: '[name].js', libraryExport: 'default', library: 'Tree', libraryTarget: 'umd', }, module: { rules: [ { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/, }, { test: /\.less$/, use: [ 'style-loader', 'css-loader', { loader: 'postcss-loader', options: { plugins: [ require('postcss-import'), require('autoprefixer'), ], }, }, 'less-loader', ], }, ], }, optimization: { minimize: true, minimizer: [ new UglifyJSPlugin({ include: /\.min\.js$/, cache: true, parallel: true, sourceMap: true, uglifyOptions: { compress: { warnings: false, comparisons: false, drop_console: true, }, mangle: { safari10: true, }, output: { comments: false, ascii_only: true, }, }, }), ], }, plugins: [ new MiniCssExtractPlugin({ filename: '[name].css', }), new OptimizeCSSAssetsPlugin({ assetNameRegExp: /\.min\.css$/, }), new webpack.BannerPlugin( 'treejs\n@version 1.8.0\n@see https://github.com/daweilv/treejs' ), new BundleAnalyzerPlugin({ analyzerMode: 'static' }), ], };