Skip to content

Commit c084ec7

Browse files
committed
fix: pass proper context param to runtime generator
BREAKING CHANGE: Possible breaks third-party runtime generators. Earlier `context` param was containing _path to compilation root context_, e.g. folder where webpack compilation occurs. This is wrong behaviour, because meaning of this param is a _folder where svg image is located_. So it was changed in this commit. If your custom runtime generator breaks after this update use `loaderContext.rootContext` option instead of `context`. Closes: #186
1 parent a2b377b commit c084ec7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/loader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function loader(content) {
1616

1717
const done = this.async();
1818
const loaderContext = this;
19-
const { resourcePath, rootContext, loaderIndex } = loaderContext;
19+
const { resourcePath, loaderIndex } = loaderContext;
2020
// webpack 1 compat
2121
const resourceQuery = loaderContext.resourceQuery || '';
2222
const compiler = loaderContext._compiler;
@@ -74,7 +74,7 @@ module.exports = function loader(content) {
7474
}
7575
svgCompiler.addSymbol({ id, content, path: resourcePath + resourceQuery })
7676
.then((symbol) => {
77-
const runtime = runtimeGenerator({ symbol, config, context: rootContext, loaderContext });
77+
const runtime = runtimeGenerator({ symbol, config, context: loaderContext.context, loaderContext });
7878
done(null, runtime);
7979
}).catch(done);
8080
};

0 commit comments

Comments
 (0)