Prepare for React: Use Haste resolver for Web

In preparation for and as another early step in rewriting the Web
version of jitsi-meet using React, use Haste resolver which is able to
distinguish among platform-independent files, Web-specific and
mobile-specific ones.

Additionally, (1) make sure that Babel is capable of understanding React
files and (2) introduce React as a dependency.

The purpose is to repeatedly take small steps towards our goal and merge
them before they get in conflict with the separate ongoing advancement
of the Web version of jitsi-meet.
This commit is contained in:
Ilya Daynatovich 2016-11-21 20:26:50 -06:00 committed by Lyubomir Marinov
parent ad6e793615
commit 766eb94c7d
2 changed files with 18 additions and 7 deletions

View File

@ -21,19 +21,21 @@
"autosize": "^1.18.13", "autosize": "^1.18.13",
"bootstrap": "3.1.1", "bootstrap": "3.1.1",
"events": "*", "events": "*",
"haste-resolver-webpack-plugin": "^0.2.2",
"i18next": "3.4.4", "i18next": "3.4.4",
"i18next-xhr-backend": "1.1.0", "i18next-xhr-backend": "1.1.0",
"jquery-i18next": "1.1.0",
"json-loader": "0.5.4",
"jQuery-Impromptu": "trentrichardson/jQuery-Impromptu#v6.0.0",
"jquery": "~2.1.1", "jquery": "~2.1.1",
"jquery-contextmenu": "*", "jquery-contextmenu": "*",
"jquery-i18next": "1.1.0",
"jQuery-Impromptu": "trentrichardson/jQuery-Impromptu#v6.0.0",
"jquery-ui": "1.10.5", "jquery-ui": "1.10.5",
"json-loader": "0.5.4",
"jssha": "1.5.0", "jssha": "1.5.0",
"jws": "*", "jws": "*",
"lib-jitsi-meet": "jitsi/lib-jitsi-meet", "lib-jitsi-meet": "jitsi/lib-jitsi-meet",
"postis": "^2.2.0", "postis": "^2.2.0",
"react": "15.3.2", "react": "15.3.2",
"react-dom": "15.3.2",
"react-native": "0.37.0", "react-native": "0.37.0",
"react-native-vector-icons": "^2.0.3", "react-native-vector-icons": "^2.0.3",
"react-native-webrtc": "jitsi/react-native-webrtc", "react-native-webrtc": "jitsi/react-native-webrtc",
@ -49,9 +51,11 @@
}, },
"devDependencies": { "devDependencies": {
"babel-core": "*", "babel-core": "*",
"babel-loader": "*", "babel-loader": "^6.2.8",
"babel-polyfill": "*", "babel-polyfill": "*",
"babel-preset-es2015": "6.14.0", "babel-preset-es2015": "6.14.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-1": "^6.16.0",
"clean-css": "*", "clean-css": "*",
"css-loader": "*", "css-loader": "*",
"eslint": ">=3", "eslint": ">=3",

View File

@ -2,6 +2,7 @@
require('babel-polyfill'); // Define Object.assign() from ES6 in ES5. require('babel-polyfill'); // Define Object.assign() from ES6 in ES5.
var HasteResolverPlugin = require('haste-resolver-webpack-plugin');
var process = require('process'); var process = require('process');
var aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/'; var aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/';
@ -16,16 +17,19 @@ var config = {
devtool: 'source-map', devtool: 'source-map',
module: { module: {
loaders: [{ loaders: [{
// Transpile ES2015 (aka ES6) to ES5. // Transpile ES2015 (aka ES6) to ES5. Accept the JSX syntax by React
// as well.
exclude: __dirname + '/node_modules/', exclude: __dirname + '/node_modules/',
loader: 'babel', loader: 'babel',
query: { query: {
presets: [ presets: [
'es2015' 'es2015',
'react',
'stage-1'
] ]
}, },
test: /\.js$/ test: /\.jsx?$/
},{ },{
// Expose jquery as the globals $ and jQuery because it is expected // Expose jquery as the globals $ and jQuery because it is expected
// to be available in such a form by multiple jitsi-meet // to be available in such a form by multiple jitsi-meet
@ -83,6 +87,9 @@ var config = {
path: __dirname + '/build', path: __dirname + '/build',
sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map' sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
}, },
plugins: [
new HasteResolverPlugin()
],
resolve: { resolve: {
alias: { alias: {
aui: aui: