react-workspaces-playground icon indicating copy to clipboard operation
react-workspaces-playground copied to clipboard

components-typescript package.json main field is confusing

Open abrkn opened this issue 5 years ago • 1 comments

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?

abrkn avatar Apr 03 '20 05:04 abrkn

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?

F1LT3R avatar Apr 23 '20 00:04 F1LT3R