Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | /* eslint-disable
|
---|
| 4 | no-undefined
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | function normalizeOptions(compiler, options) {
|
---|
| 8 | // Setup default value
|
---|
| 9 | options.contentBase =
|
---|
| 10 | options.contentBase !== undefined ? options.contentBase : process.cwd();
|
---|
| 11 |
|
---|
| 12 | // Setup default value
|
---|
| 13 | options.contentBasePublicPath = options.contentBasePublicPath || '/';
|
---|
| 14 |
|
---|
| 15 | // normalize transportMode option
|
---|
| 16 | if (options.transportMode === undefined) {
|
---|
| 17 | options.transportMode = {
|
---|
| 18 | server: 'sockjs',
|
---|
| 19 | client: 'sockjs',
|
---|
| 20 | };
|
---|
| 21 | } else {
|
---|
| 22 | switch (typeof options.transportMode) {
|
---|
| 23 | case 'string':
|
---|
| 24 | options.transportMode = {
|
---|
| 25 | server: options.transportMode,
|
---|
| 26 | client: options.transportMode,
|
---|
| 27 | };
|
---|
| 28 | break;
|
---|
| 29 | // if not a string, it is an object
|
---|
| 30 | default:
|
---|
| 31 | options.transportMode.server = options.transportMode.server || 'sockjs';
|
---|
| 32 | options.transportMode.client = options.transportMode.client || 'sockjs';
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | if (!options.watchOptions) {
|
---|
| 37 | options.watchOptions = {};
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | module.exports = normalizeOptions;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.