-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Plugin API for declaring dependencies programmatically #1203
Comments
This is fine, but I think documentation on returning |
I'd love to see this. |
@Rich-Harris any progress on this? Example: //- main.pug
include ./inner.pug
p Hello compiles to: import pug from "pug-runtime";
import "/foo/bar/inner.pug";
export default function( locals ) {
// (... code that returns "<p>Hello</p>" here...)
} inner.pug is recompiled whenever is changed, but the output goes to nowhere and main.pug remains unchanged because there's no reference to inner.pug on it (pug inline the included files). |
Same problem here, would love to see this API change implemented. |
A very needed feature indeed, would help in a lot of plugins. |
Also would love to see this. It's very uncomfortable inconvenience for projects that includes less/sass/stylus/etc with custom import system. |
Just talked to @guybedford about this. I was originally ambivalent about this feature but now that bundle splitting and the asset emission API have landed I think something like this is very necessary. |
PR created at #2259. |
@guybedford This can be closed now, yes? |
#2259 solved issue for me |
Via rollup/rollup-watch#23 (cc @droooney, @tivac). Currently, the only way for a file to declare a dependency on another file is for it to be convert to JavaScript with an
import
statement. That means that the only way to handle things like@import
statements in CSS or compile-to-CSS languages is to convert them into JavaScript somehow, which sounds a bit awkward and haphazard.Normally this isn't a problem since, if you create a CSS file by following
@import
statements and gluing multiple CSS files together, the build works as expected. But if you're using rollup-watch, it means that changes to the imported files don't have any effect.If there was a way for plugins to declare a file's dependencies programmatically – in other words, if this...
...caused
styles/layout.css
andstyles/typography.css
to be registered as dependencies ofstyles/main.css
, as well asstyles/main.css
being registered as a dependency ofapp.js
due to theimport
declaration – that problem would be solved.Proposed API:
Note that those dependencies would be in addition to any discovered by JavaScript
import
declarations, and would not be loaded by Rollup – they would just be added to the dependency graph metadata at the end of the bundling process so that rollup-watch would be able to add file watchers.The text was updated successfully, but these errors were encountered: