Skip to content

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