Skip to content

Commit

Permalink
Fix shared context between webpack instances
Browse files Browse the repository at this point in the history
Fixes #189
  • Loading branch information
maoberlehner committed Mar 16, 2019
1 parent 859acbd commit aa016fb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/node-sass-once-importer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ const EMPTY_IMPORT = {
};

export = function onceImporter() {
const contextTemplate = {
store: new Set(),
};

return function importer(url: string, prev: string) {
const nodeSassOptions = this.options;
// Create a context for the current importer run.
// An importer run is different from an importer instance,
// one importer instance can spawn infinite importer runs.
if (!this.nodeSassOnceImporterContext) {
this.nodeSassOnceImporterContext = Object.assign({}, contextTemplate);
this.nodeSassOnceImporterContext = {
store: new Set(),
};
}

// Each importer run has it's own new store, otherwise
Expand Down

0 comments on commit aa016fb

Please sign in to comment.