-
Notifications
You must be signed in to change notification settings - Fork 9
/
Gruntfile.js
67 lines (53 loc) · 1.59 KB
/
Gruntfile.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
// make sure packages like lodash are not being double stored
var DuplicatePackageCheckerPlugin = require("duplicate-package-checker-webpack-plugin");
// visualize the bundle size
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = function(grunt) {
var rootDir = __dirname;
var instdir = rootDir + '/inst/reactlog/';
var jsSrcdir = rootDir + '/srcjs/';
gruntConfig = {
webpack: {
options: {
mode: "production", // do not take time to shrink files;
devtool: "source-map", // produce a sibling source map file
stats: {
colors: true,
modules: true,
reasons: true
},
progress: true,
failOnError: true,
},
reactlog: {
entry: jsSrcdir + "index.js",
output: {
path: instdir + "reactlogAsset",
filename: 'reactlog.js'
},
plugins: [
// new BundleAnalyzerPlugin({
// analyzerMode: 'static'
// }),
// new DuplicatePackageCheckerPlugin()
],
watch: false,
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: [{
loader: "babel-loader"
}]
}]
}
}
}
};
grunt.loadNpmTasks('grunt-webpack');
grunt.task.registerTask("webpackSetWatch", "sets 'watch' to true for reactlog webpack task", function() {
gruntConfig.webpack.reactlog.watch = true
});
grunt.initConfig(gruntConfig);
grunt.registerTask("default", "webpack:reactlog")
};