Skip to content

Cache bust source map fixup - #4972

Merged
sokra merged 1 commit into
webpack:masterfrom
rafde:cache-bust-source-map-fixup
Jun 3, 2017
Merged

sokra merged 1 commit into
webpack:masterfrom
rafde:cache-bust-source-map-fixup

Conversation

@rafde

@rafde rafde commented May 31, 2017

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?
Feature

Did you add tests for your changes?
Yes

If relevant, link to documentation update:
Replaces #4137

Summary

The PR is based on a useful feature introduced by the aforementioned PR, but that PR was not updated to address PR concerns. I am trying to finish the work started.

Does this PR introduce a breaking change?

No breaking changes. Only augmentation.

Tried to contact author of original PR but no response. I prefer to get this in sooner than later.

Comment thread lib/SourceMapDevToolPlugin.js Outdated
const sourceMapUrl = path.relative(path.dirname(file), sourceMapFile).replace(/\\/g, "/");
let sourceMapUrl = path.relative(path.dirname(file), sourceMapFile).replace(/\\/g, "/");
if(sourceMapFilename.indexOf("?[contenthash]") !== -1) {
sourceMapUrl += "?" + crypto.createHash("md5").update(source).digest("hex");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use replace(/\[contenthash\]/g, ...) instead.

Comment thread lib/SourceMapDevToolPlugin.js Outdated
});
const sourceMapUrl = path.relative(path.dirname(file), sourceMapFile).replace(/\\/g, "/");
let sourceMapUrl = path.relative(path.dirname(file), sourceMapFile).replace(/\\/g, "/");
if(sourceMapFilename.indexOf("?[contenthash]") !== -1) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if(sourceMapFilename.indexOf("[contenthash]") !== -1) {

@rafde

rafde commented Jun 1, 2017

Copy link
Copy Markdown
Contributor Author

Outside topic, but your bot message

@sokra Please review the new changes.

I recommend creating a team and have the bot notify the team about new changes.

Example:

@webpack/core Please review the new changes.

Comment thread lib/SourceMapDevToolPlugin.js Outdated
const sourceMapUrl = path.relative(path.dirname(file), sourceMapFile).replace(/\\/g, "/");
let sourceMapUrl = path.relative(path.dirname(file), sourceMapFile).replace(/\\/g, "/");
if(sourceMapUrl.indexOf("[contenthash]") !== -1) {
sourceMapUrl = sourceMapUrl.replace("[contenthash]", crypto.createHash("md5").update(source).digest("hex"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use a regexp instead to replace every occurrence.

replace(/\[contenthash\]/g,

Comment thread lib/SourceMapDevToolPlugin.js Outdated
"use strict";

const path = require("path");
var crypto = require("crypto");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

const

@webpack-bot

Copy link
Copy Markdown
Contributor

@rafde Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@sokra Please review the new changes.

@rafde
rafde force-pushed the cache-bust-source-map-fixup branch from afa7702 to 84b6554 Compare June 2, 2017 17:06
@webpack-bot

Copy link
Copy Markdown
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@rafde rafde closed this Jun 2, 2017
@rafde rafde reopened this Jun 2, 2017
@rafde

rafde commented Jun 2, 2017

Copy link
Copy Markdown
Contributor Author

CI keeps failing. I don't know if I should be concerned about some of those failing.

@rafde rafde closed this Jun 2, 2017
@rafde rafde reopened this Jun 2, 2017
@sokra

sokra commented Jun 3, 2017

Copy link
Copy Markdown
Member

CI keeps failing. I don't know if I should be concerned about some of those failing.

only 1 of 3 CIs fail... that's ok... one of them is always broken, that's why we have 3 of them...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants