-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.js
executable file
·89 lines (83 loc) · 2.16 KB
/
webpack.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// You can install more packages below to config more as you like:
// eslint
// babel-eslint
// eslint-config-standard
// eslint-loader
// eslint-plugin-html
// eslint-plugin-promise
// eslint-plugin-standard
// postcss-cssnext
var path = require('path')
var webpack = require('webpack')
var bannerPlugin = new webpack.BannerPlugin(
'// { "framework": "Vue" }\n',
{ raw: true }
)
function getBaseConfig () {
return {
entry: {
app: path.resolve('./app.js')
},
output: {
path: 'dist',
},
module: {
// // You can use ESLint now!
// // Please:
// // 1. npm install {
// // babel-eslint
// // eslint
// // eslint-config-standard
// // eslint-loader
// // eslint-plugin-html
// // eslint-plugin-promise
// // } --save-dev
// // 2. set .eslintrc
// // take { "extends": "standard" } for example
// // so you need: npm install eslint-plugin-standard --save-dev
// // 3. set the config below
// preLoaders: [
// {
// test: /\.vue$/,
// loader: 'eslint',
// exclude: /node_modules/
// },
// {
// test: /\.js$/,
// loader: 'eslint',
// exclude: /node_modules/
// }
// ],
loaders: [
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
}, {
test: /\.vue(\?[^?]+)?$/,
loaders: []
}
]
},
vue: {
// // You can use PostCSS now!
// // Take cssnext for example:
// // 1. npm install postcss-cssnext --save-dev
// // 2. write `var cssnext = require('postcss-cssnext')` at the top
// // 3. set the config below
// postcss: [cssnext({
// features: {
// autoprefixer: false
// }
// })]
},
plugins: [bannerPlugin]
}
}
var webConfig = getBaseConfig()
webConfig.output.filename = '[name].web.js'
webConfig.module.loaders[1].loaders.push('vue')
var weexConfig = getBaseConfig()
weexConfig.output.filename = '[name].weex.js'
weexConfig.module.loaders[1].loaders.push('weex')
module.exports = [webConfig, weexConfig]