-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
89 lines (86 loc) · 2.3 KB
/
webpack.config.ts
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
var webpack = require('webpack');
var path = require('path');
// variables
var sourcePath = path.join(__dirname, './src');
var outPath = path.join(__dirname, './dist');
var root = path.resolve(__dirname, '.')
// plugins
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
module.exports = {
context: sourcePath,
entry: {
main: './main.ts'
},
output: {
path: outPath,
filename: '[name].bundle.js'
},
target: 'web',
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['*', '.js', '.vue', '.json'],
mainFields: ['module', 'browser', 'main']
},
module: {
rules: [
{
test: /\.ts$/,
use: {
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/]
}
}
},
{
test: /\.vue$/,
use: 'vue-loader'
},
{
test: /\.css$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}]
},
{
test: /\.scss$/,
use: [{
loader: 'css-loader'
},
{
loader: 'sass-loader'
}]
},
{ test: /\.html$/, use: 'html-loader' }
],
},
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: './assets/index.html'
}),
new webpack.NamedModulesPlugin(),
new ProgressBarPlugin()
],
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
performance: {
hints: false
},
devtool: '#eval-source-map',
node: {
// workaround for webpack-dev-server issue
// https://github.com/webpack/webpack-dev-server/issues/60#issuecomment-103411179
fs: 'empty',
net: 'empty'
}
};