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.
This commit is contained in:
Lyubomir Marinov 2016-10-11 09:08:21 -05:00
parent d55e0f70d9
commit 1edebf83ae
3 changed files with 32 additions and 36 deletions

View File

@ -1,8 +0,0 @@
{
"plugins": [
"transform-object-rest-spread"
],
"presets": [
"es2015"
]
}

View File

@ -38,10 +38,8 @@
"devDependencies": {
"babel-core": "*",
"babel-loader": "*",
"babel-plugin-transform-object-rest-spread": "*",
"babel-polyfill": "*",
"babel-preset-es2015": "6.14.0",
"babel-register": "*",
"clean-css": "*",
"css-loader": "*",
"eslint": "*",

View File

@ -1,16 +1,18 @@
/* global __dirname */
import process from 'process';
require('babel-polyfill'); // Define Object.assign() from ES6 in ES5.
const aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/';
const minimize
var process = require('process');
var aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/';
var minimize
= process.argv.indexOf('-p') != -1
|| process.argv.indexOf('--optimize-minimize') != -1;
const strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
var strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
// The base Webpack configuration to bundle the JavaScript artifacts of
// jitsi-meet such as app.bundle.js and external_api.js.
const config = {
var config = {
devtool: 'source-map',
module: {
loaders: [{
@ -18,6 +20,11 @@ const config = {
exclude: __dirname + '/node_modules/',
loader: 'babel',
query: {
presets: [
'es2015'
]
},
test: /\.js$/
},{
// Expose jquery as the globals $ and jQuery because it is expected
@ -91,27 +98,26 @@ const config = {
}
};
export default [{
// The Webpack configuration to bundle app.bundle.js (aka APP).
module.exports = [
// The Webpack configuration to bundle app.bundle.js (aka APP).
Object.assign({}, config, {
entry: {
'app.bundle': './app.js'
},
output: Object.assign({}, config.output, {
library: 'APP'
})
}),
...config,
entry: {
'app.bundle': './app.js'
},
output: {
...config.output,
library: 'APP'
}
}, {
// The Webpack configuration to bundle external_api.js (aka
// JitsiMeetExternalAPI).
...config,
entry: {
'external_api': './modules/API/external/external_api.js'
},
output: {
...config.output,
library: 'JitsiMeetExternalAPI'
}
}];
Object.assign({}, config, {
entry: {
'external_api': './modules/API/external/external_api.js'
},
output: Object.assign({}, config.output, {
library: 'JitsiMeetExternalAPI'
})
})
];