BlueBaseJS / BlueBaseJS/cli

[Web]: Add experimental support for running web projects on Expo CLI

未关闭
#50 1 条评论 0 个 reaction 已指派 1 人 已被 @danial24 认领 在 GitHub 查看
cli-web enhancement
主要语言
TypeScript
星标
1
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

Expo is now rapidly adding support for the web platform. Although it's ready for production yet, it's worth exploring their cli to run and build web project rather than using our own custom framework. This will reduce maintenance overhead.

## Strategy

This should be very straight forward as expo cli is already used to build react native projects. We may be able to use the same code with minor changes.

## Command

Experimental support can be added via `--expo` flag. So final commands will be:

```bash
bluebase web:start --expo
bluebase web:build --expo
```

## Prior Work

I've done a brief exploration of the issue without writing much code till now. Here are the findings:

1. Custom `app.json` can be used by using the `--config` flag on cli just like we do for native (This wasn't the case when I last tried a month ago).
2. [Custom Static Files](https://github.com/expo/web-examples/blob/master/docs/CUSTOMIZING-STATICS.md) are served from `web` folder in root. This seems to be the [code](https://github.com/expo/expo-cli/blob/739feb930f66194f350268d48dd451950abfcce8/packages/webpack-config/webpack/utils/getPathsAsync.js#L123) that does it. We need to find a way to change this behavior so that we can use BlueBase folder structure.
3. [Webpack Configs](https://github.com/expo/web-examples/blob/master/docs/WEBPACK.md) can be customized by putting a `webpack.config.js` in the project root. We need to find a way to put this file in a child directory to follow BlueBase folder structure. This seems to be the [code](https://github.com/expo/expo-cli/blob/4b73f2b32616389395fa3bc54c096f1d0cd8c897/packages/xdl/src/Web.ts#L118) where expo cli imports the webpack configs.

Possible solutions to point 2 & 3:

- Use a custom [projectRoot](https://github.com/expo/expo-cli/blob/739feb930f66194f350268d48dd451950abfcce8/packages/webpack-config/webpack/utils/getPathsAsync.js#L44).
- Change [working directory](https://github.com/expo/expo-cli/blob/739feb930f66194f350268d48dd451950abfcce8/packages/webpack-config/webpack/utils/getPathsAsync.js#L44) before executing expo CLI command
- Send them a PR to accept custom paths through app.json 🙃.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。