Skip to content

Commit

Permalink
chore: ensure an entry file is available for React Native
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed Jan 28, 2022
1 parent 0b4105e commit f65ae5d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion siroc.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
import { defineSirocConfig } from "siroc";
import { defineSirocConfig, PackageJson } from "siroc";
import fs from "fs";

export default defineSirocConfig({
rollup: {
output: {
sourcemap: true,
},
},
hooks: {
"build:done": (pkg) => {
// Type assertion is needed to add the `react-native`
// key. It is non-standard and not included in
// `siroc`'s built-in types.
const packageJson = pkg.pkg as PackageJson & {
["react-native"]?: string;
};

if (
packageJson.module &&
packageJson["react-native"] &&
pkg.pkg.module !== packageJson["react-native"]
) {
fs.copyFileSync(packageJson.module, packageJson["react-native"]);
}
},
},
});

0 comments on commit f65ae5d

Please sign in to comment.