Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli 模板有问题,server bundle 路径有问题 #5

Closed
pppluto opened this issue Apr 12, 2019 · 4 comments
Closed

cli 模板有问题,server bundle 路径有问题 #5

pppluto opened this issue Apr 12, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@pppluto
Copy link

pppluto commented Apr 12, 2019

cli 的模板 package.json 里边的 script 应该是 crn-cli xxx 吧?
另外 启动 bundle server,路径在 ./project_name/__tmp 目录下,应该在 ./project_name

@blackwuxin
Copy link
Contributor

fix in 3e76012

通过crn-cli start启动服务主要做两件事:
1、在当前工程目录创建一个__tmp文件夹,写入脚本文件launchPackager.commandpackager.sh
2、执行launchPackager.command启动服务。
所以,启动bundle server的路径在./project_name/__tmp目录下。

@pppluto
Copy link
Author

pppluto commented Apr 13, 2019

@blackwuxin 但是 index.js 入口文件是在 ./project_name 下

@blackwuxin
Copy link
Contributor

你说的没错,项目入口index.js是在./project_name目录下。

比较合理做法是从__tmp目录切换到./project_name目录下,再启动服务。

为什么现有crn-cli start启动服务的时候也可以正常访问呢?到@react-native-community/cli@1.5.0才传入了projectRoot参数到metro#259。而crn-cli init 创建模板工程时候,指定依赖版本@react-native-community/cli@1.4.5,在start的是也检查了@react-native-community/cli版本,对应版本号大于等于1.5.0多传入了--projectRoot进行跟目录设置。

我们会在下个版本修改下启动服务,先切换到工作目录在执行启动服务。感谢反馈。

@blackwuxin blackwuxin added the bug Something isn't working label Apr 16, 2019
@shukaka
Copy link

shukaka commented Apr 25, 2019

现在手动修改服务启动路径,会被cli覆盖掉无法生效,但是不修改的话一直报错,因为入口文件在./project_name目录下,crn却去__tmp目录中寻找,导致找不到入口文件而报错。
要怎么解决这个问题呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants