react-workspaces / react-workspaces-playground

⚛️ 🐈 Zero Config Create-React-App Monorepos with Yarn Workspaces, Lerna and React Storybook.
https://react-workspaces.github.io/react-workspaces-playground/
764 stars 128 forks source link

components-typescript package.json main field is confusing #43

Open abrkn opened 4 years ago

abrkn commented 4 years ago

In packages/components-typescript/package.json the fields main and main:src: refer to files that do not exist:

  "main": "src/index.tsx",
  "main:src": "src/index.tsx",

The index.tsx file is located in packages/components-typescript/index.tsx

Are these two fields redundant?

F1LT3R commented 4 years ago

Have you tried removing them? What happens?

I see an index.tsx in the same dir as package.json.

It may be in the wrong place. As far as collecting the babel-paths is concerned, my guess is that it should make no difference. Because the code is located in src/ babel should still be able to load the code in the child path.

It's an oversight for sure. The same issue is found in the JavaScript components dir: https://github.com/react-workspaces/react-workspaces-playground/tree/master/packages/components

It has been many months since I used React or React-Workspaces, so I'm a little rusty, but I think those index files should be moved into the src/ directory - and the index code should be:

export { default as CompOne } from './CompOne';
export { default as CompTwo } from './CompTwo';

Do you want to submit a PR?