Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provide hashed file name when using this.getFileName in generateBundle (
- Loading branch information
1 parent
2effc19
commit a0d4d69
Showing
6 changed files
with
52 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const assert = require('node:assert'); | ||
let referenceId; | ||
|
||
module.exports = { | ||
description: 'gives access to the hashed filed name via this.getFileName in generateBundle', | ||
options: { | ||
input: 'main', | ||
output: { | ||
chunkFileNames: '[name]-[hash].js' | ||
}, | ||
plugins: { | ||
buildStart() { | ||
referenceId = this.emitFile({ type: 'chunk', id: 'emitted' }); | ||
}, | ||
generateBundle() { | ||
assert.strictEqual(this.getFileName(referenceId), 'emitted-38bdd9b2.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 @@ | ||
assert.ok(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 @@ | ||
assert.ok(true); |