forked from akmolina28/mvc5-vuejs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
84 lines (83 loc) · 2.05 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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader');
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ESLintWebpackPlugin = require('eslint-webpack-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
module.exports = {
mode: 'development',
devtool: 'eval',
entry: [
'./src/js/app.js',
],
output: {
clean: true,
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist',
filename: '[name].bundle.[contenthash].js', // cache-bust
},
resolve: {
// point bundler to the vue template compiler
alias: {
'vue$': 'vue/dist/vue.esm.js',
},
// allow imports to omit file exensions,
// e.g. "import foo from 'foobar'" instead of "import foo from 'foobar.js'"
extensions: ['.js', '.vue'],
},
module: {
rules: [
// use vue-loader plugin for .vue files
{
test: /\.vue$/,
use: 'vue-loader'
},
// rule for loading .scss files
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
},
},
],
}
],
},
devServer: {
historyApiFallback: {
// SPA fallback route
index: '/dist/index.html',
},
proxy: [
{
// Proxy api routes to IIS Express
context: '/api/**',
target: 'http://localhost:64373',
}
],
},
plugins: [
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: 'css/[name].bundle.[contenthash].css', // cache-bust
}),
new HtmlWebpackPlugin({
template: 'src/index.html',
inject: true,
//favicon: 'src/images/favicon.ico',
publicPath: '/dist'
}),
new ESLintWebpackPlugin({
files: ['src'],
extensions: ['js', 'vue'],
failOnError: false // just show warnings for dev builds
}),
],
};