UNPKG

1.26 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.createCompiler = createCompiler;
7
8var _webpack = require('webpack');
9
10var _webpack2 = _interopRequireDefault(_webpack);
11
12var _path = require('path');
13
14var _path2 = _interopRequireDefault(_path);
15
16var _debug = require('debug');
17
18var _debug2 = _interopRequireDefault(_debug);
19
20function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
22var debug = (0, _debug2.default)('cyboard.compiler');
23
24function createCompiler(cyboardfile) {
25 var isDev = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
26
27 var configPath = _path2.default.resolve(__dirname, isDev ? '../config/webpack.config.dev' : '../config/webpack.config.prod');
28
29 debug('Using wepack config from ' + configPath);
30
31 // We need to load the config dynamicly because it depends on
32 // the cwd and runtime environment which is modified by liftoff.
33 // If we use an import the config will be required too early.
34 //
35 // eslint-disable-next-line global-require, import/no-dynamic-require
36 var config = require(configPath);
37
38 config.resolve.alias['injected-boards-config'] = cyboardfile;
39
40 return (0, _webpack2.default)(config);
41}
\No newline at end of file