GithubHelp home page GithubHelp logo

Comments (3)

FND avatar FND commented on July 4, 2024

Thanks for your thoughtful suggestion and for digging into the code for details!

TLDR: Yes, a PR would be most welcome.

I was a bit wary of this because it might unwittingly result in significant bloat:

switch(condition) {
case : import();
case : import();
case : import();
case : import();
}

However, @moonglum convinced me that it could be a generically useful feature, provided people know what they're doing - plus there's always the bundle-size warning if things get out of hand. So it has to be opt in, ideally prompted by a better error message than the above (something like "Error: We do not support multiple output files right now. See https://www.faucet-pipeline.org/faq#xyz for details." perhaps).

I'm unsure what that option might be called though: inlineDynamicImports is a bit clunky and, while reasonably descriptive, it might not be easy to decode if you don't already know what it's for. Plus grammatically it's a bit inconsistent with the current set of options, all of which we somehow managed to keep to a single word (more or less) - that's not a hard requirement, but it's worth pondering for a bit (FWIW, @moonglum already suggested dynamicImports: "inline", but wasn't entirely happy with that either).

PS: We do intend to support code splitting at some point, we just haven't quite had the headspace for it so far. Inlining would still be a useful option then, so this would be more than just a stopgap measure.

from faucet-pipeline-js.

grekko avatar grekko commented on July 4, 2024

Wow. That is a super fast and thorough response!

I was a bit wary of this because it might unwittingly result in significant bloat:

Ah. I see.

… provided people know what they're doing - plus there's always the bundle-size warning if things get out of hand.

Yes. I agree that the effect could potentially be unexpectedtly huge.

… ideally prompted by a better error message than the above […] See faucet-pipeline.org/faq#xyz for details." perhaps).

Right. I could not find anything on https://www.faucet-pipeline.org/js regarding multiple output files. I assume that would be added.


I am wondering if it would make sense for faucet-pipeline-js to not expose the inlineDynamicImports-configuration option right now and instead make an educated decision for the user to have dynamic imports inlined by default, effectively turning code splitting support off.

This would free users from having to run into the issue first and figuring out that the $option-to-be-named needs to be set/configured.

Once code splitting support is addressed, the $option-to-be-named could be exposed 🤔

I see the downside that this might result in significant bloat but maybe that is something that could be included as a hint in the bundle bloat message.

added:

I was thinking of a message like this:

this bundle looks to be fairly big, you might want to double-check whether that's intended and consider performance implications for your users: $path

This could be caused by faucet automatically inlining dynamically imported modules. There is an open issue to address this: #119

The linked issue – or another linked issue – could elaborate on the situation and would allow users to join the discussion (and maybe more).

I think it would be quite useful – maybe even necessary – to have an option to turn this message off though. It is great to make to quite prominent in the beginning, so that users are aware of whats going on, but this type of message can become quite annoying over time.

from faucet-pipeline-js.

FND avatar FND commented on July 4, 2024

make an educated decision for the user to have dynamic imports inlined by default

I'm not keen on this kinda magic: If people wanna use this, they really should explicitly opt in. Any attempt at guessing on our part is bound to be wrong sometimes, which just makes the situation more complicated and messy. In other words, I don't think we can/should abstract this away; users will need to understand what's going on under the hood and decide whether, effectively, they wanna change the semantics of dynamic imports for their bundles.

(I might be a little slow to respond in the coming weeks, I'm afraid.)

from faucet-pipeline-js.

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.