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

Support separate client and server bundles #751

Closed
flybayer opened this issue Jul 2, 2020 · 1 comment · May be fixed by #367
Closed

Support separate client and server bundles #751

flybayer opened this issue Jul 2, 2020 · 1 comment · May be fixed by #367
Labels
problem: stale Issue has not been responded to in some time solution: duplicate This issue or pull request already exists topic: multi-entry Related to multi-entry support

Comments

@flybayer
Copy link

flybayer commented Jul 2, 2020

Current Behavior

Currently tsdx only generates one single bundle.

Desired Behavior

We are using tsdx for Blitz.js and we need separate client and server bundles. The Blitz package has (1) code that is isopmorphic and (2) code that only runs on the server.

Currently we have two separate packages to accomplish this but it's a huge mess for code organization because we can't organize code by feature. Code for a certain feature has to be separated in two separate packages. Instead we want all this code to be in a single package.

And then we want to be able to import a specific bundle, maybe like this:

import stuff from 'pkg/client'
import stuff from 'pkg/server'

Suggested Solution

I'm not sure the best way to do this, but I could image having a file structure like this:

src/client.ts      //re-exports from all client.ts files
src/server.ts      //re-exports from all server.ts files
src/featureA/client.ts
src/featureA/server.ts
src/featureA/shared.ts

Who does this impact? Who is this for?

Anyone writing packages that have different functionality on client vs server.

Describe alternatives you've considered

Custom rollup config which I don't know how to do 😅

Additional context

blitz-js/legacy-framework#928

@agilgur5 agilgur5 added topic: multi-entry Related to multi-entry support solution: duplicate This issue or pull request already exists kind: feature New feature or request labels Jul 7, 2020
@agilgur5
Copy link
Collaborator

agilgur5 commented Jul 7, 2020

Currently we have two separate packages to accomplish this but it's a huge mess for code organization because we can't organize code by feature.

I don't think this is a technical limitation of using separate packages, you probably just need some build tooling to support importing out-of-tree instead of under the package's root directory. Some monorepos do have out-of-tree importing when those repos are closely tied together as far as I know.

And then we want to be able to import a specific bundle, maybe like this:

That specifically (which I'm not sure is totally necessary per above comment) would be a request for multiple entry points, which would be a duplicate of blitz-js/legacy-framework#841 and the WIP old PR for that blitz-js/blitz#367 .

@agilgur5 agilgur5 closed this as completed Jul 7, 2020
@agilgur5 agilgur5 linked a pull request Jul 7, 2020 that will close this issue
7 tasks
@agilgur5 agilgur5 removed the kind: feature New feature or request label Jul 7, 2020
@agilgur5 agilgur5 added the problem: stale Issue has not been responded to in some time label Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem: stale Issue has not been responded to in some time solution: duplicate This issue or pull request already exists topic: multi-entry Related to multi-entry support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants