Skip to content

add template dependencies to loader dependencies #1

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

Merged
merged 1 commit into from
Feb 25, 2019
Merged

add template dependencies to loader dependencies #1

merged 1 commit into from
Feb 25, 2019

Conversation

astik
Copy link

@astik astik commented Feb 24, 2019

In its current state, only the loader's input EJS file is defined as a dependency.
It means that everytime we update the file, webpack will trigger a new processing.

Problem is when we add included file to the template with one of those directives :

<%- include('../ejs/footer.ejs') %>
<%- include ../ejs/footer.ejs %>

We can check that EJS transitive dependencies are not exposed by looking into template.dependencies content.

As this loader is a LoaderContext instance, we have access to this.dependency which allow adding dependencies to this entry file processing :

function addDependency(file) {
	fileDependencies.push(file);
}

To declare EJS dependencies, we need to bind it from EJS to the loader :

template.dependencies.forEach(this.dependency.bind(this));

@astik
Copy link
Author

astik commented Feb 24, 2019

@rorkflash rorkflash merged commit 94a5c59 into rorkflash:2.x Feb 25, 2019
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

Successfully merging this pull request may close these issues.

2 participants