forked from liukaijv/laravel-vue-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
73 lines (71 loc) · 2.04 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
var path = require('path');
var distPath = path.join(__dirname, 'public/admin');
var srcPath = path.join(__dirname, 'resources/admin');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
main: path.join(srcPath, 'bootstrap.js'),
vendor: ['jquery']
},
output: {
path: distPath,
publicPath: '/admin/',
filename: "js/[name]-[hash].js"
},
resolve: {
extensions: ['', '.js', '.vue'],
fallback: [path.join(__dirname, '../node_modules')]
},
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
module: {
loaders: [{
test: /\.js$/,
loader: 'babel',
include: path.resolve(__dirname, 'resources/admin'),
exclude: /node_modules/,
query: {
presets: ['es2015']
}
}, {
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
}, {
test: /\.(png|jpg|gif|svg|woff2?|eot|ttf)(\?.*)?$/,
loader: 'url',
query: {
limit: 10000,
name: 'fonts/[name].[ext]'
}
}]
},
plugins: [
new ExtractTextPlugin('css/[name].css'),
new webpack.optimize.CommonsChunkPlugin('vendor', 'js/vendor-[hash].js'),
new HtmlWebpackPlugin({
template: path.join(srcPath, 'template/index.html')
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
"window.$": "jquery",
})
],
devServer: {
hot: true,
noInfo: false,
proxy: {
"/backend/*": {
target: "http://localhost:8000",
changeOrigin: true
}
}
}
};