-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
64 lines (61 loc) · 1.83 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
const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin;
const CommonConfigWebpackPlugin = require('common-config-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var node_modules_dir = path.resolve(__dirname, 'node_modules');
module.exports = {
plugins: [
// Cleans the dist folder before the build starts
new CleanWebpackPlugin(),
// Multi threading babel loader configuration with caching for .js and .jsx files
// Multi threading typescript loader configuration with caching for .ts and .tsx files
// SCSS Configuration for .css .module.css and .scss .module.scss files
// File loader configuration for .woff and .woff2 files
// File loader configuration for .gif .jpg .jpeg .png and .svg files
// https://github.com/namics/webpack-config-plugins/
new CommonConfigWebpackPlugin(),
// Generate a base html file and injects all generated css and js files
new HtmlWebpackPlugin(),
],
module: {
loaders: [{
test: /\.(js|jsx)$/,
exclude: [node_modules_dir],
loader: 'babel'
},
{
test: /\.scss$/,
exclude: [node_modules_dir],
loader: 'style!css!sass'
},
{
test: /\.css$/,
include: [
path.resolve(__dirname, "not_exist_path")
],
loader: "style!css"
},
{
test: /\.(png|jpg|woff|woff2|eot|ttf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url?limit=512&&name=[path][name].[ext]?[hash]'
}]
}
};
module.exports = {
entry: { main: './src/index.js' },
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};