-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
132 lines (118 loc) · 2.86 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
const webpack = require('webpack'),
path = require('path'),
CleanWebpackPlugin = require('clean-webpack-plugin'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
extractPlugin = new ExtractTextPlugin({ filename: './css/app.css' }),
{ VueLoaderPlugin } = require('vue-loader')
const config = {
mode: 'development',
context: path.resolve(__dirname, 'src'),
// entry: {
// // removing 'src' directory from entry point(s), since 'context' is taking care of that
// app: './app.js'
// },
entry: ['babel-polyfill', './app.js'],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
//babel-loader
{
test: /\.js$/,
include: /src/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
},
// Vue loader
{
test: /\.vue$/,
use: 'vue-loader'
},
//html-loader
{
test: /\.html$/,
use: ['html-loader']
},
//sass-loader
{
test: /\.scss$/,
include: [path.resolve(__dirname, 'src', 'scss')],
use: extractPlugin.extract({
use: [
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
outputPath: './css/'
}
}
],
fallback: 'style-loader'
})
},
//file-loader(for images)
{
test: /\.(jpg|png|gif|svg)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: './img/'
}
}
]
},
//file-loader(for fonts)
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: ['file-loader']
}
]
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
extractPlugin,
new VueLoaderPlugin()
],
devServer: {
contentBase: path.resolve(__dirname, './dist/'),
compress: true,
port: 3000,
stats: 'errors-only', // "'errors-only", "minimal", "none", "normal" & "verbose"
open: true,
host: '0.0.0.0',
hot: true,
watchOptions: {
poll: true
}
},
devtool: 'inline-source-map',
// Eliminating BABYLON dependencies warnings
// See: https://doc.babylonjs.com/features/npm_support#eliminating-the-dependencies-warnings
externals: {
"oimo": true,
"cannon": true,
"earcut": true
}
}
module.exports = config