/
webpack.config.js
55 lines (51 loc) · 1.34 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
var webpack = require('webpack');
var path = require('path');
var ROOT_PATH = path.resolve(__dirname);
var HtmlWebpackPlugin = require("html-webpack-plugin");
var HTMLWebpackPluginConfig = new HtmlWebpackPlugin({
template: ROOT_PATH + '/src/index.html',
filename: 'index.html',
inject: 'body'
})
// In webpack.config.js
module.exports = {
context: path.resolve(__dirname, './src'),
entry: path.resolve(ROOT_PATH, 'src', 'index.js'),
output: {
//path: ROOT_PATH + '/dist',
path: ROOT_PATH,
filename: "index_bundle.js"
},
resolve: {
modules: [
path.join(__dirname, "src"),
"node_modules"
]
},
devServer: {
inline: true,
port: 8080
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
},
{
test: /\.scss$/,
loader: "style-loader!css-loader!sass-loader"
},
{
test: /\.(png|jpg|)$/,
loader: 'url-loader?limit=200000'
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file?name=public/fonts/[name].[ext]'
}
]
},
plugins: [HTMLWebpackPluginConfig]
}