-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
63 lines (62 loc) · 1.74 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
/* eslint-disable */
const HtmlWebPackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require('path');
module.exports = {
context: path.join(__dirname, '/src'),
module: {
rules: [
{
test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
// Limiting the size of the woff fonts breaks font-awesome ONLY for the extract text plugin
// loader: "url?limit=10000"
use: "url-loader"
},
{
test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
use: {
loader: 'file-loader',
options: {
outputPath: 'assets/'
}
}
}, {
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
}, {
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader, // creates style nodes from JS strings
"css-loader", // translates CSS into CommonJS
"sass-loader" // compiles Sass to CSS
]
}
]
},
devtool: "inline-source-map",
devServer: {
contentBase: "./dist"
},
output: {
path: path.join(__dirname, '/dist'),
filename: "main.js"
},
plugins: [
new MiniCssExtractPlugin({
filename: "styles/[name].css",
chunkFilename: "[id].css"
}),
new CopyWebpackPlugin([
{from: "assets", to: "assets"} // not working if brackets are in project path (see https://github.com/webpack-contrib/copy-webpack-plugin/issues/231)
], {debug: 'debug', copyUnmodified: true}),
new HtmlWebPackPlugin({
template: "./index.html",
filename: "./index.html"
}),
],
entry: [
"font-awesome/scss/font-awesome.scss",
"./main.js"
]
};