Skip to content

Commit

Permalink
fix(runtime-generator): runtime generator in extract mode return obje…
Browse files Browse the repository at this point in the history
…ct instead of string

ISSUES CLOSED: #123
  • Loading branch information
kisenka committed May 22, 2017
1 parent ad0ff35 commit 208b6dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 8 additions & 1 deletion examples/extract-sprite/build/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.p + "sprite-c9cbc8.svg#twitter-usage");
/* harmony default export */ __webpack_exports__["default"] = ({
id: "twitter-usage",
viewBox: "0 0 273.4 222.2",
url: __webpack_require__.p + "sprite-c9cbc8.svg#twitter-usage",
toString: function () {
return this.url;
}
});

/***/ }),
/* 3 */
Expand Down
12 changes: 6 additions & 6 deletions lib/runtime-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ function runtimeGenerator(params) {

if (extract) {
const spritePlaceholder = generateSpritePlaceholder(symbol.request.file);
const data = {
id: symbol.id,
viewBox: stringify(symbol.viewBox),
url: `__webpack_public_path__ + ${stringify(spritePlaceholder)}`,
toString: function toString() {
const data = `{
id: ${stringify(symbol.useId)},
viewBox: ${stringify(symbol.viewBox)},
url: __webpack_public_path__ + ${stringify(spritePlaceholder)},
toString: function () {
return this.url;
}
};
}`;

runtime = generateExport(data, esModule);
} else {
Expand Down

0 comments on commit 208b6dc

Please sign in to comment.