1 | const path = require('path');
|
2 | const merge = require('webpack-merge');
|
3 | const baseConfig = require('./webpack.base');
|
4 | const Components = require('../components.json');
|
5 | const requireContext = require('require-context')
|
6 | const keys = requireContext(path.join(__dirname,'../src/locale/lang'),false,/\.js$/).keys()
|
7 | const langs = {}
|
8 | keys.forEach(key=>{
|
9 | langs[`locale/lang/${key.split('.js')[0]}`] =`./src/locale/lang/${key}`
|
10 | })
|
11 |
|
12 | module.exports = merge(baseConfig, {
|
13 | mode: 'production',
|
14 | entry: Object.assign(
|
15 | {
|
16 | kview:'./src/index.js',
|
17 | provider:'./src/components/provider',
|
18 | },
|
19 | langs,
|
20 | Components
|
21 | ),
|
22 | output: {
|
23 | path: path.resolve(process.cwd(), './lib'),
|
24 | publicPath: '/lib/',
|
25 | filename: '[name]/index.js',
|
26 | chunkFilename: '[id]/index.js',
|
27 | libraryTarget: 'commonjs2'
|
28 | },
|
29 | optimization: {
|
30 | minimize: false,
|
31 | },
|
32 | externals:{
|
33 | vue: {
|
34 | root: 'vue',
|
35 | commonjs: 'vue',
|
36 | commonjs2: 'vue',
|
37 | amd: 'vue'
|
38 | },
|
39 | },
|
40 | }) |
\ | No newline at end of file |