Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Undocumented requirement for compileStatic plugins. #1760

Open
rminderhoud opened this issue Nov 14, 2017 · 0 comments
Open

Undocumented requirement for compileStatic plugins. #1760

rminderhoud opened this issue Nov 14, 2017 · 0 comments
Labels

Comments

@rminderhoud
Copy link

rminderhoud commented Nov 14, 2017

I discovered an interesting edge case today and wanted to bring it up to the maintainers. I am not sure whether the solution is a code change or a documentation update, hence this post.

Description

Not accessing file.data() in compileStatic results in the file raw data being used rather than the compiled asset data.

Source of issue:

asset._wasProcessed is only set if asset.data() was called at least once.

See asset.js#83

Expected behavior

I expect that it should be sufficient that a compiler gets called on the file for it to be tracked as processed

Example

Works

compileStatic(file) {
    file.data;
    Promise.resolve(file);
}

Does not work:

compileStatic(file) {
    Promise.resolve(file);
}
@paulmillr paulmillr added the docs label Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants