-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.dev.js
109 lines (105 loc) · 2.66 KB
/
webpack.config.dev.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
102
103
104
105
106
107
108
109
const webpack = require("webpack");
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const { VueLoaderPlugin } = require("vue-loader");
const srcDir = path.join(__dirname, "src");
const config = {
mode: "development",
devtool: "none",
entry: {
main: [path.join(srcDir, "boot.ts")]
},
output: {
path: path.join(__dirname, "docs"),
filename: "[name].js",
publicPath: "/"
},
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
options: {
appendTsSuffixTo: [/\.vue$/]
},
include: [srcDir, resolve("node_modules/webpack-dev-server/client")]
},
{
test: /\.vue$/,
loader: "vue-loader"
},
{
test: /\.s?css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ["css-loader", "sass-loader"]
})
},
{
test: /\.(png|jpe?g|gif|svg|mp4|webm|ogg|mp3|wav|flac|aac|woff2?|eot|ttf|otf)(\?.*)?$/,
loader: "url-loader",
options: {
limit: 10000,
name: "[name].[hash:7].[ext]"
}
}
]
},
resolve: {
extensions: [".ts", ".js", ".vue", ".styl", ".css"],
alias: {
vue$: "vue/dist/vue.esm.js",
bulma: "bulma/css/bulma.css",
"@fortawesome/fontawesome-free-solid":
"@fortawesome/fontawesome-free-solid/shakable.es.js",
"@": srcDir
}
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new VueLoaderPlugin(),
new ExtractTextPlugin({
disable: true
}),
new HtmlWebpackPlugin({
inject: "head",
template: path.join(srcDir, "index.template.html")
}),
new ScriptExtHtmlWebpackPlugin({
defaultAttribute: "defer"
})
],
devServer: {
clientLogLevel: "warning",
historyApiFallback: {
rewrites: [
{
from: /.*/,
to: "/index.html"
}
]
},
hot: true,
compress: true,
port: 8080,
overlay: { warnings: false, errors: true }
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: "empty",
fs: "empty",
net: "empty",
tls: "empty",
child_process: "empty"
}
};
module.exports = config;
function resolve(dir) {
return path.join(__dirname, "..", dir);
}