forked from code-farmer-i/vue-markdown-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.theme.js
42 lines (41 loc) · 1.27 KB
/
webpack.theme.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
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');
module.exports = merge(getBaseConfig({ useCssExtract: true }), {
mode: 'production',
entry: {
base: './src/theme/base/base',
hljs: './src/theme/base/highlight',
prism: './src/theme/base/prism',
github: './src/theme/github/index',
vuepress: './src/theme/vuepress/index',
'github-parser': './src/theme/github/parser',
'vuepress-parser': './src/theme/vuepress/parser',
},
output: {
library: 'VMdTheme',
libraryTarget: 'umd',
libraryExport: 'default',
path: path.join(__dirname, '../lib/theme'),
umdNamedDefine: true,
filename: '[name].js',
globalObject: "typeof self !== 'undefined' ? self : this",
},
optimization: {
minimize: true,
},
plugins: [
new CleanWebpackPlugin(),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: cssnano,
cssProcessorPluginOptions: {
preset: ['default', { discardComments: { removeAll: true } }],
},
canPrint: true,
}),
],
});