1 |
|
2 |
|
3 |
|
4 | var path = require('path');
|
5 |
|
6 |
|
7 | var ROOT = path.resolve(__dirname, '..');
|
8 |
|
9 | function hasProcessFlag(flag) {
|
10 | return process.argv.join('').indexOf(flag) > -1;
|
11 | }
|
12 |
|
13 | function isWebpackDevServer() {
|
14 | return process.argv[1] && !! (/webpack-dev-server$/.exec(process.argv[1]));
|
15 | }
|
16 |
|
17 | function root(args) {
|
18 | args = Array.prototype.slice.call(arguments, 0);
|
19 | return path.join.apply(path, [ROOT].concat(args));
|
20 | }
|
21 |
|
22 | function checkNodeImport(context, request, cb) {
|
23 | if (!path.isAbsolute(request) && request.charAt(0) !== '.') {
|
24 | cb(null, 'commonjs ' + request); return;
|
25 | }
|
26 | cb();
|
27 | }
|
28 |
|
29 | exports.hasProcessFlag = hasProcessFlag;
|
30 | exports.isWebpackDevServer = isWebpackDevServer;
|
31 | exports.root = root;
|
32 | exports.checkNodeImport = checkNodeImport;
|