Giter Site home page Giter Site logo

Comments (12)

timreichen avatar timreichen commented on May 28, 2024

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.

ebebbington avatar ebebbington commented on May 28, 2024

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.

timreichen avatar timreichen commented on May 28, 2024

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.

ebebbington avatar ebebbington commented on May 28, 2024

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.

timreichen avatar timreichen commented on May 28, 2024

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.

ebebbington avatar ebebbington commented on May 28, 2024

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.

timreichen avatar timreichen commented on May 28, 2024

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.

alfredosalzillo avatar alfredosalzillo commented on May 28, 2024

@timreichen mirroring the src folder can be useful to bundle modular libraries

from bundler.

timreichen avatar timreichen commented on May 28, 2024

@alfredosalzillo how do you mean?

from bundler.

timreichen avatar timreichen commented on May 28, 2024

Closing due to inactivity. Feel free to reopen.

from bundler.

ebebbington avatar ebebbington commented on May 28, 2024

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.

timreichen avatar timreichen commented on May 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.