forked from danielroach9/GRR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
78 lines (70 loc) · 1.84 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var webpack = require('webpack');
var path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
var BUILD_DIR = path.resolve(__dirname, './grr-ui/build');
var APP_DIR = path.resolve(__dirname, './grr-ui/src');
const pathsToClean = [
'./grr-ui/build/bundle*.*', // removes all files in 'build' folder
]
const config = {
devtool: "source-map",
entry: {
main: APP_DIR + '/index.js'
},
output: {
filename: 'bundle.js',
path: BUILD_DIR
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: 'css-loader'
})
},
{
test: /\.(png|jpg|gif)$/,
use: [{
loader: 'file-loader',
options: {
publicPath: BUILD_DIR
}
}]
},
{
test: /\.(jsx|js)?$/,
//exclude: __dirname + '/grr-ui/src/api',
use: [{
loader: "babel-loader",
options: {
cacheDirectory: true,
presets: ['react', 'es2016'] // Transpiles JSX and ES6
}
}],
},
],
},
plugins: [
new ExtractTextPlugin('style.css'),
new CopyWebpackPlugin([
{ from: './grr-ui/src/api', to: './api' },
{ from: './grr-ui/src/assets', to: './assets'},
{ from: './grr-ui/src/favicon.ico'},
{ from: './grr-ui/src/index.html'},
{ from: './grr-ui/src/js', to:"./js"},
{ from: './grr-ui/src/dependencies', to:"./dependencies"}
])
]
};
module.exports = config;