Summary: As a first step I've configured bundling for the main process code using Metro. For now I haven't converted anything to ts, just made that possible. The bundle is just produced into the "static" directory. To avoid too many changes I kept the "static" folder as it is, but probably non-static code should be moved from there. Also installed modules from "node_modules" for the main process are not bundled to avoid potential issues with node native modules. Reviewed By: mweststrate Differential Revision: D19960982 fbshipit-source-id: efbd426254e2b37c913c5f5f75f042c50ccee2f3
34 lines
991 B
JavaScript
34 lines
991 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
module.exports = function(babel, options) {
|
|
return {
|
|
name: 'change-process-to-electronProcess',
|
|
visitor: {
|
|
MemberExpression(path) {
|
|
if (
|
|
path.node.object.type === 'Identifier' &&
|
|
path.node.object.name === 'process' &&
|
|
!path.scope.hasBinding('process')
|
|
) {
|
|
path.node.object.name = 'electronProcess';
|
|
} else if (
|
|
path.node.object.type === 'MemberExpression' &&
|
|
path.node.object.object.type === 'Identifier' &&
|
|
path.node.object.object.name === 'global' &&
|
|
path.node.object.property.type === 'Identifier' &&
|
|
path.node.object.property.name === 'process'
|
|
) {
|
|
path.node.object.property.name = 'electronProcess';
|
|
}
|
|
},
|
|
},
|
|
};
|
|
};
|