Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions addStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,17 @@ function attachTagAttrs(element, attrs) {
function addStyle(obj, options) {
var styleElement, update, remove;

if (obj.sourceMap && typeof options.sourceRoot === "string") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rockmacaca This is not mandatory, more of a triage 😛 , but would it be a breaking change, if we change the signature of sourceMap to sourceMap: Boolean || { sourceRoot: '...' } instead of adding a new option sourceRoot ? Shouldn't be, but needs to be verified

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I would rather go with this than to add yet another field to the API. Better reuse this time.

Copy link
Copy Markdown
Contributor

@michael-ciniawsky michael-ciniawsky Apr 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (obj.sourceMap && !obj.sourceMap.sourceRoot.match(/webpack:\/\/\//) {
  obj.sourceMap.sourceRoot = 'webpack:///' + obj.sourceMap.sourceRoot
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rockmacaca Something in that direction is what I mean by 'can we avoid adding an extra option'? 🙃 If not possible and the user needs control over this, then it can't be helped 😛

obj.sourceMap.sourceRoot = options.sourceRoot;
}

if (options.singleton) {
var styleIndex = singletonCounter++;
styleElement = singletonElement || (singletonElement = createStyleElement(options));
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
} else if(obj.sourceMap &&
options.sourceMap !== false &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
Expand Down