-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.example.config.js
55 lines (50 loc) · 1.44 KB
/
webpack.example.config.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
43
44
45
46
47
48
49
50
51
52
53
54
55
/* global __dirname */
let path = require('path');
let webpack = require('webpack');
let LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
let babelSettings = JSON.stringify({
plugins: ['es6-promise', 'lodash', 'babel-plugin-transform-function-bind', 'transform-object-rest-spread'],
presets: ['es2015'],
cacheDirectory: true
});
let settings = JSON.stringify({
definitions: ['dev']
});
module.exports = {
entry: {
index: ['./example/index.htm', './example/index.js']
},
output: {
path: path.resolve(__dirname, 'build/example'),
filename: '[name].js'
},
resolve: {
modules: [
path.resolve('.'),
path.resolve('./example'),
path.resolve('./node_modules'),
path.resolve('./src')
],
alias: {
vue: 'vue/dist/vue.js',
'vuex-model-template': 'src/index.js'
},
extensions: ['.js']
},
module: {
rules: [
{
test: /\/example\/index\.htm(l?)$/,
loader: 'file-loader?name=[name].[ext]'
}, {
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: `babel-loader?${babelSettings}!webpack-preprocessor?${settings}`
}
]
},
plugins: [
new LodashModuleReplacementPlugin,
new webpack.optimize.OccurrenceOrderPlugin
]
};