Skip to content
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

Stop bundling files into a single bundle #48

Closed
n1ru4l opened this issue Jun 15, 2022 · 2 comments · Fixed by #55
Closed

Stop bundling files into a single bundle #48

n1ru4l opened this issue Jun 15, 2022 · 2 comments · Fixed by #55

Comments

@n1ru4l
Copy link
Collaborator

n1ru4l commented Jun 15, 2022

Instead of bundling everything into a single bundle, the original file structure within the src folder should be kept. This allows users to do deep imports.

@ardatan
Copy link
Collaborator

ardatan commented Jun 17, 2022

I think people should be able to configure multiple entrypoints instead of using the source directory structure.

@n1ru4l
Copy link
Collaborator Author

n1ru4l commented Jun 20, 2022

I agree with @ardatan on configuring custom entry points. Bob should check the following for the exports map:

  1. All the exports point to existing files
  2. All the exports are TypeScript module resolution compatible

In addition, the bootstrap command (I created in #55) should help people with onboarding to bob and give good defaults.


An overview of the current build process:

Today, transpilation from ts to js is achieved by running tsc, followed by bundling and copying files via bob build.

In a monorepository the following happens:

tsc creates

  • <monorepo-root>/dist/<package-name>/src/*.js (esm)
  • <monorepo-root>/dist/<package-name>/src/*.d.ts (type-defs)

bob build does:

  • resolves the path of the previous files
  • creates a single esm and cjs bundle from the tsc emitted files at <monorepo-root>/packages/<package-name>/dist/index.(m).js
  • copies the type-definitions to <monorepo-root>/packages/<package-name>/dist/**/*.d.ts
  • generates a package.json at <monorepo-root>/packages/<package-name>/dist/package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants