Skip to content

Update document for removing ReleaseBundle and DebugBundle #3702

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

Merged
merged 2 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "none",
"comment": "Update doc to removing DebugBundle and ReleaseBundle",
"packageName": "react-native-windows",
"email": "licanhua@live.com",
"commit": "806c4059c397d9ff09054461e368a78cfb50880b",
"date": "2019-11-25T19:54:34.125Z"
}
52 changes: 52 additions & 0 deletions vnext/docs/ConsumingRNW.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,58 @@ See [Native Modules and React Native Windows](NativeModules.md).
## Building a standalone React Native Windows App
Follow these steps to build a version of your app that you can install or publish to the store. This version will package your bundle and assets into the appx package so you don't need to run Metro.

- Open the solution in Visual Studio
- Select the Release configuration from the Configuration Manager dropdown.
- Build the solution. You can now launch without first launching Metro.
- If you want to build an appx package to share or publish, use the Project => Publish => Create App Packages... option.

You may hit [error Unable to resolve module `warnOnce`](https://github.com/microsoft/react-native-windows/issues/3670) if you compile the project from Visual Studio IDE. You can workaround the problem by using lower driver-letter in `BundleCommand`. For example, if your solution directory is `C:\repo\myproj\windows`, then modify `BundleCommand` in your project from

```
<BundleCommand>
cd $(SolutionDir)..
...
</BundleCommand>
```
to
```
<BundleCommand>
cd c:\repo\myproj
...
</BundleCommand>
```

## Migrating your project from old React Native Windows template
If your application is created from old React Native template, you have to remove DebugBundle and ReleaseBundle configurations manually, then make Release configuration to support Bundle. You can find examples in [PR 3654](https://github.com/microsoft/react-native-windows/pull/3654). Here is the steps to migrate your project manually:
- Remove DebugBundle and ReleaseBundle from the solution.

- Provide BundleCommand in the project file
```
<PropertyGroup>
<BundleCommand>
cd $(SolutionDir)..
react-native bundle --platform windows --entry-file index.windows.js --bundle-output windows/SampleAppCpp/Bundle/index.windows.bundle --assets-dest windows/SampleAppCpp/Bundle
</BundleCommand>
</PropertyGroup>
```

- Import Bundle.targets or Bundle.Cpp.targets.

For CS project
```
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.targets" />
```

For Cpp project
```
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Bundle.Cpp.targets" />
```

## Building a standalone React Native Windows App which is created from old React Native Windows template
Note: DebugBundle and ReleaseBundle are not supported anymore because of [issue 3657](https://github.com/microsoft/react-native-windows/issues/3657). Please follow the migrate steps above to migrate your project if you want to use newer version of React Native Windows.

Follow these steps to build a version of your app that you can install or publish to the store. This version will package your bundle and assets into the appx package so you don't need to run Metro.

- Open the solution in Visual Studio
- Select the DebugBundle or ReleaseBundle configuration from the Configuration Manager dropdown. DebugBundle is similar to Debug in that it adds more debugging info to the native code. Use this if you want to debug the native code. ReleaseBundle is similar to Release, you'll typically use this when producing a final package to publish to the store.
- Build the solution. You can now launch without first launching Metro.
Expand Down