UNPKG

1.13 kBJavaScriptView Raw
1const path = require('path');
2const merge = require('webpack-merge');
3const baseConfig = require('./webpack.base');
4const Components = require('../components.json');
5const requireContext = require('require-context')
6const keys = requireContext(path.join(__dirname,'../src/locale/lang'),false,/\.js$/).keys()
7const langs = {}
8keys.forEach(key=>{
9 langs[`locale/lang/${key.split('.js')[0]}`] =`./src/locale/lang/${key}`
10})
11
12module.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