forked from code-farmer-i/vue-markdown-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.pkg.js
49 lines (46 loc) · 1.23 KB
/
webpack.pkg.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const path = require('path');
const merge = require('webpack-merge');
const getBaseConfig = require('./webpack.base');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const cssnano = require('cssnano');
const { entryFiles } = require('./build-entry');
const entry = {};
entryFiles.forEach((fileName) => {
entry[fileName] = `./src/${fileName}.js`;
});
module.exports = merge(getBaseConfig({ useCssExtract: true }), {
mode: 'production',
entry,
output: {
library: 'VMdEditor',
libraryTarget: 'umd',
libraryExport: 'default',
path: path.join(__dirname, '../lib'),
umdNamedDefine: true,
filename: '[name].js',
globalObject: "typeof self !== 'undefined' ? self : this",
},
externals: {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue',
},
},
optimization: {
minimize: false,
},
plugins: [
new CleanWebpackPlugin(),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: cssnano,
cssProcessorPluginOptions: {
preset: ['default', { discardComments: { removeAll: true } }],
},
canPrint: true,
}),
],
});