Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7947 from philipwalton/mjs-sourcemap-support
Add sourcemap support for .mjs output files
- Loading branch information
Showing
11 changed files
with
64 additions
and
3 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
6 changes: 6 additions & 0 deletions
6
test/configCases/source-map/default-filename-extensions-css/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,6 @@ | ||
it("creates source maps for .css output files by default", function() { | ||
var fs = require("fs"); | ||
var source = fs.readFileSync(__filename, "utf-8"); | ||
var match = /sourceMappingURL\s*=\s*(.*)\*\//.exec(source); | ||
expect(match[1]).toBe("bundle0.css.map"); | ||
}); |
3 changes: 3 additions & 0 deletions
3
test/configCases/source-map/default-filename-extensions-css/test.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,3 @@ | ||
var foo = {}; | ||
|
||
module.exports = foo; |
11 changes: 11 additions & 0 deletions
11
test/configCases/source-map/default-filename-extensions-css/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,11 @@ | ||
module.exports = { | ||
mode: "development", | ||
output: { | ||
filename: "bundle0.css" | ||
}, | ||
node: { | ||
__dirname: false, | ||
__filename: false | ||
}, | ||
devtool: "source-map" | ||
}; |
6 changes: 6 additions & 0 deletions
6
test/configCases/source-map/default-filename-extensions-js/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,6 @@ | ||
it("creates source maps for .js output files by default", function() { | ||
var fs = require("fs"); | ||
var source = fs.readFileSync(__filename, "utf-8"); | ||
var match = /sourceMappingURL\s*=\s*(.*)/.exec(source); | ||
expect(match[1]).toBe("bundle0.js.map"); | ||
}); |
3 changes: 3 additions & 0 deletions
3
test/configCases/source-map/default-filename-extensions-js/test.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,3 @@ | ||
var foo = {}; | ||
|
||
module.exports = foo; |
11 changes: 11 additions & 0 deletions
11
test/configCases/source-map/default-filename-extensions-js/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,11 @@ | ||
module.exports = { | ||
mode: "development", | ||
output: { | ||
filename: "bundle0.js" | ||
}, | ||
node: { | ||
__dirname: false, | ||
__filename: false | ||
}, | ||
devtool: "source-map" | ||
}; |
6 changes: 6 additions & 0 deletions
6
test/configCases/source-map/default-filename-extensions-mjs/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,6 @@ | ||
it("creates source maps for .mjs output files by default", function() { | ||
var fs = require("fs"); | ||
var source = fs.readFileSync(__filename, "utf-8"); | ||
var match = /sourceMappingURL\s*=\s*(.*)/.exec(source); | ||
expect(match[1]).toBe("bundle0.mjs.map"); | ||
}); |
3 changes: 3 additions & 0 deletions
3
test/configCases/source-map/default-filename-extensions-mjs/test.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,3 @@ | ||
var foo = {}; | ||
|
||
module.exports = foo; |
11 changes: 11 additions & 0 deletions
11
test/configCases/source-map/default-filename-extensions-mjs/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,11 @@ | ||
module.exports = { | ||
mode: "development", | ||
output: { | ||
filename: "bundle0.mjs" | ||
}, | ||
node: { | ||
__dirname: false, | ||
__filename: false | ||
}, | ||
devtool: "source-map" | ||
}; |