-
Notifications
You must be signed in to change notification settings - Fork 3
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 #16 from agoda-com/AVAILABILI-3470
FEATURE: Send vite bundle stats
- Loading branch information
Showing
7 changed files
with
139 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { OutputAsset, OutputBundle, OutputChunk } from "rollup"; | ||
|
||
export function generateViteOutputBundleData(includeBootstrapChunk: boolean): OutputBundle { | ||
const bootstrapChunk: OutputChunk = { | ||
name: 'bootstrap', | ||
type: 'chunk', | ||
code: 'console.log("Bygone visions of life asunder, long since quelled by newfound wonder.");' + | ||
'console.log("Bygone visions of life asunder, long since quelled by newfound wonder.");' + | ||
'console.log("Bygone visions of life asunder, long since quelled by newfound wonder.");' + | ||
'console.log("Bygone visions of life asunder, long since quelled by newfound wonder.");' + | ||
'console.log("Bygone visions of life asunder, long since quelled by newfound wonder.");' | ||
} as unknown as OutputChunk; | ||
|
||
const nonBootstrapChunkA: OutputChunk = { | ||
name: 'notBootstrapA', | ||
type: 'chunk', | ||
code: 'random sentence to pass my time' | ||
} as unknown as OutputChunk; | ||
|
||
const nonBootstrapChunkB: OutputChunk = { | ||
name: 'notBootstrapB', | ||
type: 'chunk', | ||
code: 'random sentence to pass my time again' | ||
} as unknown as OutputChunk; | ||
|
||
const assetNamedBootstrap: OutputAsset = { | ||
name: 'bootstrap', | ||
fileName: 'bootstrap.jpg', | ||
type: 'asset', | ||
source: '../../assets/bootstrap.jpg', | ||
needsCodeReference: false | ||
}; | ||
|
||
const bundle = { | ||
'a-not-bootstrap.js': nonBootstrapChunkA, | ||
'b-not-bootstrap.js': nonBootstrapChunkB, | ||
'bootstrap.jpg': assetNamedBootstrap | ||
} | ||
|
||
if (includeBootstrapChunk) { | ||
bundle['bootstrap.xyz123.js'] = bootstrapChunk | ||
} | ||
|
||
return bundle; | ||
} |
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