-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.dev-server.config.js
101 lines (98 loc) · 3.57 KB
/
webpack.dev-server.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
90
91
92
93
94
95
96
97
98
99
100
101
var path = require('path');
var webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const HtmlWebpackHarddiskPlugin = require("html-webpack-harddisk-plugin");
var config = {
entry: {
index: [path.resolve(__dirname, 'source/index.js')]
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
}
},
output: {
//path and public Path is meaningless when used by expressjs
path: path.resolve(__dirname, 'bundle/'),
publicPath: "/bundle/",
filename: "[name].bundle.js",
chunkFilename: "[id].chunk.js"
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'webpack-module-hot-accept',
exclude: /(semantic.js)|(node_modules)/,
},
{
test: /\.(js)$/,
loader: 'babel-loader',
exclude: /(semantic.js)|(node_modules)/,
query: {
presets: ["env"]
}
},
{
test: /\.(vue)$/,
loader: 'vue-loader',
/*
options: {
loaders: {
{{#sass}}
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
// the "scss" and "sass" values for the lang attribute to the right configs here.
// other preprocessors should work out of the box, no loader config like this necessary.
'scss': 'vue-style-loader!css-loader!sass-loader',
'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
{{/sass}}}
*/
},
{ test: /\.json$/, loader: "json-loader" },
{ test: /\.css$/, loader: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ["css-loader"],
publicPath: "./"
}) },
{ test: /\.(png|jpg|gif)$/, loader: 'url-loader?limit=8192' }, // inline base64 URLs for <=8k images, direct URLs for the rest
{ test: /\.woff(2)?(\?v=[0-9\.]+)?$/, loader: "url-loader?prefix=font/&limit=5000" },
{ test: /\.(eot|ttf|svg)(\?v=[0-9\.]+)?$/, loader: "url-loader?prefix=font/&limit=5000" },
{ test: require.resolve("jquery"), loader: "expose-loader?$!expose-loader?jQuery" },
{ test: require.resolve("vue/dist/vue.esm.js"), loader: "expose-loader?Vue" }, //exposed at Vue.default
// { test: require.resolve("lodash"), loader: "expose?_" },
]
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
//new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new ExtractTextPlugin('[name].bundle.css'),
// new webpack.LoaderOptionsPlugin({
// debug: true
// }),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
}),
new HtmlWebpackPlugin({
filename: '../source/index.html',
template: './source/index.template.html',
alwaysWriteToDisk: true
}),
new HtmlWebpackHarddiskPlugin()
],
devtool: "#source-map",
devServer: {
contentBase: './source/',
port: 3000,
// historyApiFallback: {
// index: '/',
// rewrites: [
// { from: /^\/config\/*/, to: '/config/'}
// ]
// }
}
};
module.exports=config;