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

Bundling source and deps into top-level js #1169

Closed
pablo-mayrgundter opened this issue Aug 28, 2022 · 2 comments · Fixed by #2312
Closed

Bundling source and deps into top-level js #1169

pablo-mayrgundter opened this issue Aug 28, 2022 · 2 comments · Fixed by #2312
Labels
enhancement New feature or request

Comments

@pablo-mayrgundter
Copy link

pablo-mayrgundter commented Aug 28, 2022

What is the problem this feature will solve?

I'm missing how to achieve simple bundler functionality. Looks like most of the machinery is there, or maybe this is just a doc bug. GH docs seem to indicate bundling is possible "While you could use bun's bundler & transpiler separately to build for browsers or node".

I asked around on discord and wasn't clear how.

What is the feature you are proposing to solve the problem?

I'd like to specify an entry point and and output bundle name so that I can load it into a host index.html.

# index.jsx
import React from 'react'
import {render} from 'react-dom'
function App() { return <h1>Hello Whirled!</h1> }
render(<App/>)
> bun bun --entry=src/index.jsx --out=bun-bundle.js

and have this operate as a top-level modules in HTML:

<script type="module" src="./bun-bundle.js"></script>

And have that index.jsx evaluated such that the render is called and you see Hello Whirled! in a static serving env.

What alternatives have you considered?

Currently, bun bun and the exported code is only the modules

bun bun src/index.jsx && ./node_modules.bun > public/node_modules.js

But then that means I need to bundle my jsx with a different tool and usually huge set of deps and that I'm looking to get rid of by using bun.

Great project so far!

@pablo-mayrgundter pablo-mayrgundter added the enhancement New feature or request label Aug 28, 2022
@pablo-mayrgundter
Copy link
Author

pablo-mayrgundter commented Oct 14, 2022

@pablo-mayrgundter
Copy link
Author

I heard back from Jared on their Discord. He confirmed this is not yet supported but will be.

Only the node_modules are bundled in the .bun file, not the application's own source.

https://discord.com/channels/876711213126520882/1005605542028394536/1030586977227120641

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

Successfully merging a pull request may close this issue.

1 participant