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

Expose the modulepreload entry graphs rather than modifying HTML #4

Open
philipwalton opened this issue Aug 9, 2019 · 1 comment
Open

Comments

@philipwalton
Copy link

For my modulepreload use case, I don't have a static HTML file that I want to modify, I have a template file that I want to pass data to (e.g. the list of files that need preloading). It looks something like this:

{% for module in modulepreload %}
    <link rel="modulepreload" href="/public/{{ module }}"></script>
{%- endfor %}

At the most basic level, what I need from a modulepreload plugin for Rollup is something that inspects my bundle and gives me back a list files that need preloading. Then I (myself) can chose what I want to do with that list of files, and how I want to get it into my HTML.

There are also cases where the list of files to preload depends on what URL the user navigates to, and that can only be determined at run time, not at build time. In such cases a template would need more than just a single list, it would need a mapping of entry points to their static graphs (I've filed #3 to address that issue).

This issue is more about answering the question of how a developer gets the list of files to preload from this plugin to the HTML. I think letting them pass a function to the plugin that gets invoked with the entry graphs should be sufficient.

@bennypowers
Copy link
Owner

This sounds like a very useful feature I'd be happy to review a PR

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

No branches or pull requests

2 participants