-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.config.js
88 lines (83 loc) · 2.67 KB
/
webpack.prod.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
const path = require('path');
const webpack = require('webpack');
const DefinePlugin = webpack.DefinePlugin;
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebPackPlugin = require("html-webpack-plugin");
const CompressionPlugin = require('compression-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, 'resources/ut-tei/src'),
entry: [
'./index.js'
// the entry point of our app
],
output: {
filename: 'ut-tei.js',
path: path.resolve(__dirname, 'resources/ut-tei/dist'),
publicPath: 'resources/ut-tei/dist/'
},
devtool: false,
module: {
rules: [
{
test: /\.jsx?$/,
use: ['babel-loader',],
exclude: /node_modules/
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
use: [
{
loader: "css-loader", options: {minimize: true} // translates CSS into CommonJS
},
{
loader: "sass-loader" // compiles Sass to CSS
}
],
// use style-loader in development
fallback: "style-loader"
}
)
},
{
test: /\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/,
use: 'url-loader'
},
{
test: /\.html$/,
use: [
{
loader: "html-loader"
}
]
},
{
test: /\.(png|gif|jpg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
include: path.resolve(__dirname, 'resources/ut-tei/src/media'),
use: [
{
loader: 'file-loader?name=media/[name].[ext]'
}
]
}
]
},
plugins: [
new DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new ExtractTextPlugin({filename: 'ut-tei.css', allChunks: true}),
new HtmlWebPackPlugin({
template: path.join(__dirname, "./resources/ut-tei/src/index.html"),
filename: "./index.html"
}),
new UglifyJsPlugin({
sourceMap: false
}),
new CompressionPlugin()
],
};