1 | var fs = require('fs')
|
2 | var webpack = require('webpack')
|
3 | var merge = require('webpack-merge')
|
4 | var baseConfig = require('./webpack.base.conf')
|
5 | var HtmlWebpackPlugin = require('html-webpack-plugin')
|
6 |
|
7 |
|
8 | Object.keys(baseConfig.entry).forEach(function (name) {
|
9 | baseConfig.entry[name] = ['./build/dev-client'].concat(baseConfig.entry[name])
|
10 | })
|
11 |
|
12 |
|
13 | fs.readdirSync('./examples').forEach((file) => {
|
14 | baseConfig.plugins.push(
|
15 |
|
16 | new HtmlWebpackPlugin({
|
17 | filename: file + '.html',
|
18 | template: `examples/${file}/index.html`,
|
19 | inject: false
|
20 | })
|
21 | )
|
22 | })
|
23 |
|
24 |
|
25 | fs.readdirSync('./examples').forEach((file) => {
|
26 | baseConfig.entry[file + 'App'] = `./examples/${file}/main.js`
|
27 | })
|
28 |
|
29 | module.exports = merge(baseConfig, {
|
30 |
|
31 | devtool: '#eval-source-map',
|
32 | output: {
|
33 |
|
34 |
|
35 | publicPath: '/'
|
36 | },
|
37 | plugins: [
|
38 |
|
39 | new webpack.optimize.OccurenceOrderPlugin(),
|
40 | new webpack.HotModuleReplacementPlugin(),
|
41 | new webpack.NoErrorsPlugin(),
|
42 |
|
43 | new HtmlWebpackPlugin({
|
44 | filename: 'index.html',
|
45 | template: 'index.html',
|
46 | inject: true
|
47 | })
|
48 | ]
|
49 | })
|