webpack.config.vue.js
2.12 KB
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
var path = require('path');
var Glob = require('glob');
var fs = require('fs');
var vue = require('vue-loader');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var baseName="./static/js.vue";
module.exports = {
resolve: {
alias: {
jquery: path.resolve(baseName, './jquery.js'),
vue: path.resolve(baseName, './vue.min.js'),
echarts:path.resolve(baseName, './echarts.simple.min.js'),
util:path.resolve(baseName, './util.js')
},
extensions: ['', '.js', '.vue', '.scss']
},
module: {
loaders: [
{ test: /\.vue$/, loader: "vue" },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract("style-loader", 'css-loader!autoprefixer!sass-loader') },
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ },
{ test: /\.(png|jpg|gif)$/, loader: 'url?limit=10000&name=./images/[name].[ext]?[hash:10]', },
]
},
babel: {
"presets": ["es2015"],
"plugins": ["transform-runtime"]
},
plugins: [
new ExtractTextPlugin("styles.css"),
new webpack.optimize.CommonsChunkPlugin('libs','libs.js'),
new webpack.ProvidePlugin({
$: 'jquery'
})
],
vue: {
loaders: {
js: 'babel'
}
}
}
//var vueLoader = {
// js: 'babel',
// css: ExtractTextPlugin.extract("vue-style-loader", "css-loader"),
// scss: ExtractTextPlugin.extract("vue-style-loader", "css-loader", 'sass-loader')
//};
//if (process.env.NODE_ENV === 'production') {
// module.exports.vue.loaders = vueLoader;
// module.exports.plugins = (module.exports.plugins || []).concat([
// new webpack.DefinePlugin({
// 'process.env': {
// NODE_ENV: '"production"'
// }
// }),
// new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: false
// }
// }),
// new webpack.optimize.OccurenceOrderPlugin()
// ]);
//} else {
// module.exports.devtool = 'source-map';
//}
module.exports.devtool = 'source-map';