Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
102 lines (93 loc) · 2.96 KB
/
Copy pathwebpack.config.js
File metadata and controls
102 lines (93 loc) · 2.96 KB
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
var webpack = require('webpack');
var path = require('path');
const glob = require('glob');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const PurifyCSSPlugin = require('purifycss-webpack');
var inProduction = (process.env.NODE_ENV === 'production');
module.exports = {
entry: {
app: [
'./src/js/main.js',
'./src/sass/app.scss'
]
},
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/', // OVO MORA da bude navedeno zbog slika koje VIS koristi
filename: '[name].js'
},
module: {
rules: [
{
test: /\.s[ac]ss$/,
use: ExtractTextPlugin.extract({
use: ['css-loader', 'sass-loader'],
fallback: 'style-loader'
})
},
//{
// test: /\.scss$/,
// use: [{
// loader: "style-loader" // creates style nodes from JS strings
// }, {
// loader: "css-loader" // translates CSS into CommonJS
// }, {
// loader: "sass-loader" // compiles Sass to CSS
// }]
//},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},
{
test: /node_modules[\\\/]vis[\\\/].*\.js$/,
loader: 'babel-loader',
query: {
cacheDirectory: true,
presets: ["es2015"],
plugins: [
"transform-es3-property-literals",
"transform-es3-member-expression-literals",
"transform-runtime"
]
}
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
}
]
},
plugins: [
new ExtractTextPlugin('[name].css'),
new PurifyCSSPlugin({
paths: glob.sync(path.join(__dirname, 'index.html')),
minimize: inProduction
}),
new webpack.LoaderOptionsPlugin({
minimize: inProduction
})
],
devtool: '#eval-source-map'
};
if (inProduction) {
// change publicPath to './dist/' when env is production
module.exports.output.publicPath = './dist/';
module.exports.devtool = '#source-map';
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
})
);
}