Created
September 2, 2020 12:44
-
-
Save GitaiQAQ/87fb40030aafa73b8debc8a58cf0477f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| { | |
| name: 'InlineScriptHTMLRender', | |
| async generateBundle(_, bundles, isWrite) { | |
| if (isWrite) { | |
| return new Promise((resolve) => { | |
| Object.values(bundles).map((bundle) => { | |
| Object.keys(bundles).map(key => delete bundles[key]); | |
| if (bundle.name === 'bootloader') { | |
| renderFile('src/index.ejs', { | |
| inlineScript: bundle.code, | |
| }, { | |
| rmWhitespace: true, | |
| }, (err, source) => { | |
| if (err) throw err; | |
| this.emitFile({ | |
| type: 'asset', | |
| source, | |
| name: 'Rollup HTML Asset', | |
| fileName: 'index.html', | |
| }); | |
| resolve(); | |
| }); | |
| } | |
| }); | |
| }); | |
| } | |
| }, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment