microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.28k stars 1.14k forks source link

Automatically Support TypeScript Entry Files When Bundling in Release Build #7807

Open NickGerleman opened 3 years ago

NickGerleman commented 3 years ago

We have the following MSBuild logic in Bundle.props to determine the bundle entry:

    <!-- Entry file of the JS bundle. Defaults to use index.windows.js if it exists, otherwise index.js -->
    <BundleEntryFile Condition="'$(BundleEntryFile)' == '' and Exists('$(BundleCommandWorkingDir)\index.windows.js')">index.windows.js</BundleEntryFile>
    <BundleEntryFile Condition="'$(BundleEntryFile)' == ''">index.js</BundleEntryFile>

This logic means that if you rename your entry to a ts or tsx file, your bundle server will work fine, but release builds will start to fail.

We should be more liberal in entry point extensions to allow for TS, JSX, TSX, etc.

hossamnasser938 commented 3 years ago

Any update on this?

NickGerleman commented 3 years ago

No update yet to make things work automatically, but you can set "BundleEntryFile" in your app vcxproj to "index.ts" or "index.tsx" in the meantime.

See here for an example https://github.com/microsoft/react-native-windows/blob/main/packages/integration-test-app/windows/integrationtest/integrationtest.vcxproj