Comments (12)
I don't quite understand that use case. Bundler needs entry files specified, else it does not know which files to bundle up. Do you mean to transpile/transform all files in a dir instead of bundling?
from bundler.
I don't quite understand that use case. Bundler needs entry files specified, else it does not know which files to bundle up. Do you mean to transpile/transform all files in a dir instead of bundling?
Yeah pretty much, so instead of having to do:
$ bundler bundle src/js/home.ts=dist/js/home.js src/js/call.ts=dist/js/call.js # annd maybe 10 more files
You could do:
$ bundler bundle src/js=dist/js
from bundler.
That is an interesting use case. Though it kinda pervents what bundler is meant to do doesn‘t it? Why would you want to do that instead of bundling?
I don‘t like magic path resolutions so I think I won’t implement it like that. But I guess that could be achieved by a simple script that collects all paths recursively and then call the bundler command.
from bundler.
I guess it just saves having a command that could be upwards of 100-200 characters long to specify every file (as opposed to using an entrypoint)
I mean it's no biggie, the again, you (as in thee user) could just store the command in a Makefile
and reuse it from there 🤔
from bundler.
No I mean, why would you even want to have so many files as entry files? In what use case would that be practical?
from bundler.
Take https://github/Okku/destiny as an example, they plan on moving to Deno, but compile all their source code into a dist directory, with the dist
dir mirroring src
from bundler.
Is there an advantage on a mirrored dist
dir over a flattened one? I am currently working on the next iteration of bundler, so if there is I might want to consider it.
from bundler.
@timreichen mirroring the src
folder can be useful to bundle modular libraries
from bundler.
@alfredosalzillo how do you mean?
from bundler.
Closing due to inactivity. Feel free to reopen.
from bundler.
Is there an advantage on a mirrored
dist
dir over a flattened one? I am currently working on the next iteration of bundler, so if there is I might want to consider it.
Not necessarily, it's more about the bundle result not being a single file, if every file was bundled individually, I could still link to my page specific js files eg <script src="/assets/pagejs/users/new.js">
Though as it stands, it seems like I'd have to handle some kind of routing in the app.ts
(entrypoint to bundle), so when I do link the bundled file in my views, js related. to other pages wont run, for example:
import UserNewPageJS from "./users/new"
import UserIndexPageJS from "./users/index"
import HeaderPageJS from "./header"
if (window.location.href === "/users/new")
UserNewPageJS.init() // just initiates the DOM event listeners
if (window.location.href === "users")
... // same as above
HeaderPageJS.init()
from bundler.
@ebebbington I guess that is slightly missing the goal of this project. bundler should, well, bundle files together to make webpage download as fast as possible. Maybe dynamic imports can solve the problem?
import HeaderPageJS from "./header.ts"
if (window.location.href === "/users/new")
await import("./users/new.ts")
if (window.location.href === "users")
await import("./users/index.ts")
HeaderPageJS.init()
from bundler.
Related Issues (20)
- how to disable export default in final js bundle file? HOT 2
- Use as a api HOT 2
- API: bundle function don't write output assets HOT 2
- API doc
- hello_world examples not working HOT 1
- Generic lambda compiled as React components HOT 1
- export default is working only with function HOT 1
- bundler and bundler api are not emiting javascript output HOT 3
- examples/server don't work HOT 2
- spa dev server example HOT 1
- project struture in read me HOT 1
- API Examples failing
- Feature Request: Support circular dependencies HOT 3
- Bundler fails to run when trying to import `acorn` via `terser` HOT 5
- Crash with CSS Gradients: `TypeError: i.walkFunctionNodes is not a function` HOT 3
- Does not understand .mjs extension / script type HOT 1
- Fails to download one of the dependency files HOT 3
- Bundler misinterprets Windows path as a url HOT 4
- Newline behavior HOT 4
- Guide for create pluging HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bundler.