Skip to content

Commit

Permalink
Change addDependency to only add css-base.js
Browse files Browse the repository at this point in the history
All other dependencies are added by LoaderContext.loadModule() automatically
  • Loading branch information
benurb committed Jul 28, 2017
1 parent c9b266a commit f5a1946
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/extractLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ function extractLoader(content) {
.resolve(path.dirname(this.resourcePath), resourcePath)
.split("?")[0];

// Mark the file as dependency so webpack's watcher is working
this.addDependency(absPath);

// If the required file is the css-loader helper, we just require it with node's require.
// If the required file should be processed by a loader we do not touch it (even if it is a .js file).
if (/^[^!]*css-base\.js$/i.test(resourcePath)) {
// Mark the file as dependency so webpack's watcher is working for css-base.js. Other dependencies
// are automatically added by loadModule() below
this.addDependency(absPath);

return require(absPath); // eslint-disable-line import/no-dynamic-require
}

Expand Down Expand Up @@ -88,6 +89,7 @@ function extractLoader(content) {
*/
function loadModule(request) {
return new Promise((resolve, reject) => {
// LoaderContext.loadModule automatically calls LoaderContext.addDependency for all requested modules
this.loadModule(
request,
(err, src) => (err ? reject(err) : resolve(src))
Expand Down

0 comments on commit f5a1946

Please sign in to comment.