Просмотр исходного кода

Remove .babelrc to simplify React Native support

React Native's module bundler (aka packager) has its default Babel
preset - react-native/babel-preset - which it uses in the absence of a
custom .babelrc. Unfortunately, the default may be tripped by the
presence of a .babelrc in dependencies. Additionally, if the default
does not get tripped, the npm install of lib-jitsi-meet as a dependency
may fall into a recursion in which Babel attempts to transpile
react-native/babel-preset. To reduce the risks of stumbling upon such
problems, move Babel's configuration inside the Webpack configuration
file.
dev1
Lyubomir Marinov 9 лет назад
Родитель
Сommit
a6e1ff3450
3 измененных файлов: 15 добавлений и 16 удалений
  1. 0
    5
      .babelrc
  2. 0
    1
      package.json
  3. 15
    10
      webpack.config.js

+ 0
- 5
.babelrc Просмотреть файл

@@ -1,5 +0,0 @@
1
-{
2
-    "presets": [
3
-        "es2015"
4
-    ]
5
-}

+ 0
- 1
package.json Просмотреть файл

@@ -34,7 +34,6 @@
34 34
     "babel-loader": "*",
35 35
     "babel-polyfill": "*",
36 36
     "babel-preset-es2015": "*",
37
-    "babel-register": "*",
38 37
     "eslint": "*",
39 38
     "jshint": "^2.8.0",
40 39
     "precommit-hook": "^3.0.0",

webpack.config.babel.js → webpack.config.js Просмотреть файл

@@ -1,13 +1,13 @@
1 1
 /* global __dirname */
2 2
 
3
-import child_process from 'child_process'; // eslint-disable-line camelcase
4
-import process from 'process';
3
+var child_process = require('child_process'); // eslint-disable-line camelcase
4
+var process = require('process');
5 5
 
6
-const minimize
6
+var minimize
7 7
     = process.argv.indexOf('-p') !== -1
8 8
         || process.argv.indexOf('--optimize-minimize') !== -1;
9 9
 
10
-export default {
10
+module.exports = {
11 11
     devtool: 'source-map',
12 12
     entry: {
13 13
         'lib-jitsi-meet': './JitsiMeetJS.js'
@@ -21,7 +21,7 @@ export default {
21 21
                 flags: 'g',
22 22
                 replace:
23 23
                     child_process.execSync( // eslint-disable-line camelcase
24
-                            `${__dirname}/get-version.sh`)
24
+                            __dirname + '/get-version.sh')
25 25
 
26 26
                         // The type of the return value of
27 27
                         // child_process.execSync is either Buffer or String.
@@ -32,15 +32,20 @@ export default {
32 32
                             .trim(),
33 33
                 search: '{#COMMIT_HASH#}'
34 34
             },
35
-            test: `${__dirname}/JitsiMeetJS.js`
35
+            test: __dirname + '/JitsiMeetJS.js'
36 36
         }, {
37 37
             // Transpile ES2015 (aka ES6) to ES5.
38 38
 
39 39
             exclude: [
40
-                `${__dirname}/modules/RTC/adapter.screenshare.js`,
41
-                `${__dirname}/node_modules/`
40
+                __dirname + '/modules/RTC/adapter.screenshare.js',
41
+                __dirname + '/node_modules/'
42 42
             ],
43 43
             loader: 'babel',
44
+            query: {
45
+                presets: [
46
+                    'es2015'
47
+                ]
48
+            },
44 49
             test: /\.js$/
45 50
         } ]
46 51
     },
@@ -51,9 +56,9 @@ export default {
51 56
         __filename: true
52 57
     },
53 58
     output: {
54
-        filename: `[name]${minimize ? '.min' : ''}.js`,
59
+        filename: '[name]' + (minimize ? '.min' : '') + '.js',
55 60
         library: 'JitsiMeetJS',
56 61
         libraryTarget: 'umd',
57
-        sourceMapFilename: `[name].${minimize ? 'min' : 'js'}.map`
62
+        sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
58 63
     }
59 64
 };

Загрузка…
Отмена
Сохранить