forked from valor-software/ngx-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
37 lines (31 loc) · 985 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
33
34
35
36
37
/* eslint no-process-env: 0, global-require:0 */
/**
* @author: @AngularClass
*/
'use strict';
// Look in ./config folder for webpack.dev.js
const conf = getWebpackConfig(process.env.NODE_ENV, require('./.ng2-config'));
// marked renderer hack
const marked = require('marked');
marked.Renderer.prototype.code = function renderCode(code, lang) {
const escCode = code.replace(/</g, '<').replace(/>/g, '>');
if (!lang) {
return `<pre class="prettyprint" ngNonBindable>${escCode}</pre>`;
}
return `<pre class="prettyprint lang-${lang}" ngNonBindable>${escCode}</pre>`;
};
module.exports = conf;
function getWebpackConfig(env, config) {
switch (env) {
case 'prod':
case 'production':
return require('ng2-webpack-config').webpack.prod(config);
case 'test':
case 'testing':
return require('ng2-webpack-config').webpack.test(config);
case 'dev':
case 'development':
default:
return require('ng2-webpack-config').webpack.dev(config);
}
}