-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
32 lines (26 loc) · 950 Bytes
/
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
const webpack = require('webpack');
const fs = require('fs');
const path = require('path'),
join = path.join,
resolve = path.resolve;
const getConfig = require('hjs-webpack');
// creating path variables to help us optimise our configuration
// when we start modifying it from default setup
const root = resolve(__dirname);
const src = join(root, 'src');
const modules = join(root, 'node_modules');
const dest = join(root, 'dist');
const NODE_ENV = process.env.NODE_ENV;
const isDev = NODE_ENV === 'development';
// alternatively we can use process.argv[1]
// const isDev = (process.argv[1] || '').indexOf('hjs-dev-server') !== -1;
//..
var config = getConfig({
isDev: isDev,
in: join(src, 'app.js'), // entry file
out: dest, // path to a directory to generate files
clearBeforeBuild: true
})
// exporting a configuration object as webpack expects us to so that it can
// access the config variable
module.exports = config;