-
Notifications
You must be signed in to change notification settings - Fork 478
Conversation
4dbdbdc
to
741e231
Compare
added exbuild stuff refactor Update EsbuildConfig.ts Update utils.ts Added logging middleware Added symbolicator remove legacy added license Clean up extras clean up more split out logging plugin Unify platform extensions Refactor refactor refactor Update EsbuildDevServer.ts
741e231
to
f70e2f2
Compare
packages/dev-server/src/middleware/createSymbolicateMiddleware.ts
Outdated
Show resolved
Hide resolved
packages/dev-server/src/middleware/remoteDevtoolsCorsMiddleware.ts
Outdated
Show resolved
Hide resolved
packages/dev-server/src/middleware/remoteDevtoolsSecurityHeadersMiddleware.ts
Outdated
Show resolved
Hide resolved
}) | ||
.filter(Boolean) as string[]; | ||
|
||
const packagesRemoveFlow = new RegExp( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split out of function and test
const patchPlugin: Plugin = { | ||
name: 'patches', | ||
setup(build) { | ||
build.onLoad({ filter: /views[\\|/]GestureHandlerNative\.js$/ }, args => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upstream fix
build.onEnd((result: any) => { | ||
if (result.errors.length) { | ||
logger.info( | ||
{ tag: 'metro' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a new tag “bundler” which can be used for general events
name: 'expoLogging', | ||
setup(build) { | ||
build.onStart(() => { | ||
logger.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add progress support if possible. Also figure out why progress loader isn’t showing in-app.
Possibly related to the issue where logs don’t show up in flipper
const { registerAsset } = require('react-native/Libraries/Image/AssetRegistry.js') | ||
${asset.files | ||
.map( | ||
file => `const ${camelize(path.parse(file).name)} = require('${file.replace(/\\/g, '/')}')` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test multi resolution handling
watch: { | ||
onRebuild(error, result) { | ||
if (error) { | ||
options.logger.error({ tag: 'esbuild' }, `watch build failed: ${error}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use “bundler” tag or maybe “devServer”
import { replaceMiddlewareWith } from '../middleware/replaceMiddlewareWith'; | ||
import getBuildOptions from './EsbuildConfig'; | ||
|
||
const nativeMiddleware = (port: number, _platform: string) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up, focus on JS, maps, assets, and move into a generic function. In theory, this would need to be so good that we could use it across metro and esbuild.
@@ -39,7 +39,12 @@ | |||
"@expo/metro-config": "0.1.78", | |||
"@react-native-community/cli-server-api": "^5.0.1", | |||
"body-parser": "1.19.0", | |||
"deepmerge": "^4.2.2", | |||
"deno-importmap": "^0.1.6", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe drop this one
Use generic logger tag Simplify symbolicator fix config Remove deepmerge fixup config
9875773
to
36f7bef
Compare
Why
esbuild is a bundler written with native code, react-native is almost exclusively used with Metro bundler. This PR demonstrates how esbuild could be implemented at scale for cross platform React apps. Based on some work I did in mid-2020 -- tweet.
How
Initially I built the system using a fork of React Native that had flow stripped out. Since then, esbuild has added a plugin system which can manually strip flow (suboptimal as every project must do this).
Most of the plugin system was assembled by @dalcib in his project exbuild, symbolication is based on re.pack.
The purpose of this PR is to show users how modular the bundler system is in Expo CLI, and how a new bundler can be added.
Planned
EXPO_BUNDLER=esbuild expo start --dev-client
Test Plan
Run the following in an Expo project:
And open the project in the Expo Go app on iOS. Use
EXPO_PLATFORM=android
to bundle for Android (should improve this long term).r
,m
,shift+m
in the terminal to interact with the client.Stack Traces
Throw an error in the project to test symbolication, similar traces should be collapsed in esbuild. There is a known bug right now where the LogBox doesn't format the symbols unless you tap to the next error/warning.