Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle
webpack://
prefix in SourceMap sources
- Loading branch information
Showing
23 changed files
with
411 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/configCases/source-map/relative-source-maps-by-loader/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
it("should run", () => { | ||
require("./loader-source-root!"); | ||
require("./loader-source-root-slash!"); | ||
require("./loader-source-root-source-slash!"); | ||
require("./loader-source-root-2-slash!"); | ||
require("./loader-no-source-root!"); | ||
require("./loader-pre-relative!"); | ||
}); | ||
|
||
it("should generate the correct SourceMap", function() { | ||
var fs = require("fs"); | ||
var source = JSON.parse(fs.readFileSync(__filename + ".map", "utf-8")); | ||
expect(source.sources).toContain("webpack:///./folder/test1.txt"); | ||
expect(source.sources).toContain("webpack:///./folder/test2.txt"); | ||
expect(source.sources).toContain("webpack:///./folder/test3.txt"); | ||
expect(source.sources).toContain("webpack:///./folder/test4.txt"); | ||
expect(source.sources).toContain("webpack:///./folder/test5.txt"); | ||
expect(source.sources).toContain("webpack:///./folder/test6.txt"); | ||
}); |
10 changes: 10 additions & 0 deletions
10
test/configCases/source-map/relative-source-maps-by-loader/loader-no-source-root.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const path = require("path"); | ||
module.exports = function() { | ||
this.callback(null, "module.exports = 'ok';", { | ||
version: 3, | ||
file: "/should/be/removed", | ||
sources: [path.join(__dirname, "folder", "test5.txt")], | ||
sourcesContent: ["Test"], | ||
mappings: "AAAA" | ||
}); | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/configCases/source-map/relative-source-maps-by-loader/loader-pre-relative.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = function() { | ||
this.callback(null, "module.exports = 'ok';", { | ||
version: 3, | ||
file: "/should/be/removed", | ||
sources: ["webpack://./folder/test6.txt"], | ||
sourcesContent: ["Test"], | ||
mappings: "AAAA" | ||
}); | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/configCases/source-map/relative-source-maps-by-loader/loader-source-root-2-slash.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const path = require("path"); | ||
module.exports = function() { | ||
this.callback(null, "module.exports = 'ok';", { | ||
version: 3, | ||
file: "/should/be/removed", | ||
sourceRoot: path.join(__dirname, "folder") + "/", | ||
sources: ["/test4.txt"], | ||
sourcesContent: ["Test"], | ||
mappings: "AAAA" | ||
}); | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/configCases/source-map/relative-source-maps-by-loader/loader-source-root-slash.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const path = require("path"); | ||
module.exports = function() { | ||
this.callback(null, "module.exports = 'ok';", { | ||
version: 3, | ||
file: "/should/be/removed", | ||
sourceRoot: path.join(__dirname, "folder") + "/", | ||
sources: ["test3.txt"], | ||
sourcesContent: ["Test"], | ||
mappings: "AAAA" | ||
}); | ||
}; |
11 changes: 11 additions & 0 deletions
11
.../configCases/source-map/relative-source-maps-by-loader/loader-source-root-source-slash.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const path = require("path"); | ||
module.exports = function() { | ||
this.callback(null, "module.exports = 'ok';", { | ||
version: 3, | ||
file: "/should/be/removed", | ||
sourceRoot: path.join(__dirname, "folder"), | ||
sources: ["/test2.txt"], | ||
sourcesContent: ["Test"], | ||
mappings: "AAAA" | ||
}); | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/configCases/source-map/relative-source-maps-by-loader/loader-source-root.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const path = require("path"); | ||
module.exports = function() { | ||
this.callback(null, "module.exports = 'ok';", { | ||
version: 3, | ||
file: "/should/be/removed", | ||
sourceRoot: path.join(__dirname, "folder"), | ||
sources: ["test1.txt"], | ||
sourcesContent: ["Test"], | ||
mappings: "AAAA" | ||
}); | ||
}; |
8 changes: 8 additions & 0 deletions
8
test/configCases/source-map/relative-source-maps-by-loader/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
mode: "development", | ||
node: { | ||
__dirname: false, | ||
__filename: false | ||
}, | ||
devtool: "source-map" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import test from "./module"; | ||
console.log(test); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
console.log("test"); | ||
import("./chunk"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import test from "./module"; | ||
console.log(test); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
console.log("test"); | ||
import("./chunk"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
validate(stats) { | ||
const a = stats.stats[0].compilation.hash; | ||
const b = stats.stats[1].compilation.hash; | ||
expect(a).toBe(b); | ||
const c = stats.stats[2].compilation.hash; | ||
const d = stats.stats[3].compilation.hash; | ||
expect(c).toBe(d); | ||
} | ||
}; |
Oops, something went wrong.