Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit sourcemaps as assets and add comments before generateBundle
- Loading branch information
1 parent
1e7f339
commit 6f5f74d
Showing
9 changed files
with
66 additions
and
53 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
test/function/samples/sourcemap-inline-generatebundle/_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
33 changes: 33 additions & 0 deletions
33
test/function/samples/sourcemap-true-generatebundle/_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,33 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'emits sourcemaps before generateBundle hook', | ||
options: { | ||
plugins: [ | ||
{ | ||
name: 'test', | ||
generateBundle(options, bundle) { | ||
assert.deepStrictEqual(Object.keys(bundle), ['main.js', 'main.js.map']); | ||
assert.strictEqual( | ||
bundle['main.js'].code, | ||
`'use strict'; | ||
var main = 42; | ||
module.exports = main; | ||
//# sourceMappingURL=main.js.map | ||
` | ||
); | ||
assert.deepStrictEqual(bundle['main.js.map'], { | ||
fileName: 'main.js.map', | ||
name: undefined, | ||
source: | ||
'{"version":3,"file":"main.js","sources":["main.js"],"sourcesContent":["export default 42;\\n"],"names":[],"mappings":";;AAAA,WAAe,EAAE;;;;"}', | ||
type: 'asset' | ||
}); | ||
} | ||
} | ||
], | ||
output: { sourcemap: true } | ||
} | ||
}; |
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
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