UNPKG

1.62 kBJavaScriptView Raw
1const path = require('path');
2const merge = require('webpack-merge');
3const baseConfig = require('./webpack.base');
4const CopyPlugin = require('copy-webpack-plugin');
5
6const demoConfig = merge(baseConfig, {
7 mode: 'development',
8 entry: {
9 kview: './examples/index'
10 },
11 output: {
12 path: path.resolve(process.cwd(), './dist'),
13 publicPath: './',
14 filename: '[name]/index.js',
15 chunkFilename: '[id]/index.js',
16 libraryTarget: 'umd'
17 },
18 optimization: {
19 splitChunks: {
20 // include all types of chunks
21 chunks: 'all',
22 cacheGroups: {
23 vendors: {
24 test: /[\\/]node_modules[\\/]/,
25 priority: -10
26 },
27 elementBase: {
28 test: (module) => {
29 return /element-ui/.test(module.context);
30 },
31 name: "elementBase",
32 priority: 10,
33 },
34 default: {
35 minChunks: 2,
36 priority: -20,
37 reuseExistingChunk: true
38 }
39 }
40 },
41 minimize: false,
42 },
43 externals: {
44 'vue': 'Vue',
45 'vue-router': 'VueRouter',
46 'element-ui': 'ELEMENT',
47 },
48 plugins: [
49 new CopyPlugin({
50 patterns: [
51 {
52 from: './**/*',
53 context:'public/',
54 to: './',
55 },
56 ],
57 }),
58 ]
59})
60
61
62module.exports = demoConfig
\No newline at end of file