From 766eb94c7d4cb9d999fe6babcb01902c24166bea Mon Sep 17 00:00:00 2001 From: Ilya Daynatovich Date: Mon, 21 Nov 2016 20:26:50 -0600 Subject: [PATCH] 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. --- package.json | 12 ++++++++---- webpack.config.js | 13 ++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index f0b133956..22d4bee88 100644 --- a/package.json +++ b/package.json @@ -21,19 +21,21 @@ "autosize": "^1.18.13", "bootstrap": "3.1.1", "events": "*", + "haste-resolver-webpack-plugin": "^0.2.2", "i18next": "3.4.4", "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-contextmenu": "*", + "jquery-i18next": "1.1.0", + "jQuery-Impromptu": "trentrichardson/jQuery-Impromptu#v6.0.0", "jquery-ui": "1.10.5", + "json-loader": "0.5.4", "jssha": "1.5.0", "jws": "*", "lib-jitsi-meet": "jitsi/lib-jitsi-meet", "postis": "^2.2.0", "react": "15.3.2", + "react-dom": "15.3.2", "react-native": "0.37.0", "react-native-vector-icons": "^2.0.3", "react-native-webrtc": "jitsi/react-native-webrtc", @@ -49,9 +51,11 @@ }, "devDependencies": { "babel-core": "*", - "babel-loader": "*", + "babel-loader": "^6.2.8", "babel-polyfill": "*", "babel-preset-es2015": "6.14.0", + "babel-preset-react": "^6.16.0", + "babel-preset-stage-1": "^6.16.0", "clean-css": "*", "css-loader": "*", "eslint": ">=3", diff --git a/webpack.config.js b/webpack.config.js index 977f9aa57..4db42097d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ require('babel-polyfill'); // Define Object.assign() from ES6 in ES5. +var HasteResolverPlugin = require('haste-resolver-webpack-plugin'); var process = require('process'); var aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/'; @@ -16,16 +17,19 @@ var config = { devtool: 'source-map', module: { 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/', loader: 'babel', query: { presets: [ - 'es2015' + 'es2015', + 'react', + 'stage-1' ] }, - test: /\.js$/ + test: /\.jsx?$/ },{ // Expose jquery as the globals $ and jQuery because it is expected // to be available in such a form by multiple jitsi-meet @@ -83,6 +87,9 @@ var config = { path: __dirname + '/build', sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map' }, + plugins: [ + new HasteResolverPlugin() + ], resolve: { alias: { aui: