UNPKG

gdy-quill-editor

Version:

基于Quill的vue编辑器组件 npm@0.1.6

132 lines (128 loc) 2.79 kB
const path = require('path') const webpack = require('webpack') const MiniCssExtractPlugin = require('mini-css-extract-plugin') const TerserPlugin = require('terser-webpack-plugin') const VueLoaderPlugin = require('vue-loader/lib/plugin') const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin') module.exports = { devtool: 'cheap-module-source-map', entry: './lib/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'gdy-editor.js', library: 'numberWord', libraryExport: 'default', globalObject: 'this', libraryTarget: 'umd', }, mode: 'production', resolve: { alias: { vue$: 'vue/dist/vue.esm.js', '@': path.resolve('lib'), }, }, module: { rules: [ { test: /\.js$/, include: [path.join(__dirname, 'lib')], exclude: /(node_modules|bower_components)/, use: [ { loader: 'babel-loader', options: { // presets: [['es2015', { modules: false }]], plugins: [ '@babel/plugin-proposal-class-properties', // 'plugin-proposal-class-properties', ], }, }, ], }, { test: /\.svg$/, use: [ { loader: 'raw-loader', }, ], }, { test: /\.vue$/, use: [ { loader: 'vue-loader', }, ], }, { test: /\.css$/, use: [ MiniCssExtractPlugin.loader, // 'style-loader', // 'vue-style-loader', 'css-loader', ], }, { test: /\.scss$/, use: [ MiniCssExtractPlugin.loader, 'css-loader', { loader: 'sass-loader', options: { sourceMap: true, }, }, ], }, { test: /\.(jpg|png|gif)$/i, include: /lib/, use: [ { loader: 'url-loader', options: { limit: 8192, }, }, ], }, ], }, plugins: [ new MiniCssExtractPlugin({ filename: '[name].css', }), new webpack.ProvidePlugin({ _: ['lodash'], }), new VueLoaderPlugin(), ], optimization: { minimizer: [ new OptimizeCSSAssetsPlugin({}), new TerserPlugin({ cache: true, parallel: true, sourceMap: true, terserOptions: { compress: { drop_console: true, }, }, }), ], }, externals: { lodash: { commonjs: 'lodash', commonjs2: 'lodash', amd: 'lodash', root: '_', }, }, }