-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
properly render manifest in watch mode
- Loading branch information
Showing
7 changed files
with
60 additions
and
33 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
24 changes: 24 additions & 0 deletions
24
packages/vite-plugin-web-extension/src/plugins/bundle-tracker-plugin.ts
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,24 @@ | ||
import { OutputAsset, OutputChunk } from "rollup"; | ||
import { Plugin } from "vite"; | ||
import { BUNDLE_TRACKER_PLUGIN_NAME } from "../utils/constants"; | ||
|
||
export interface BundleTrackerPlugin extends Plugin { | ||
getChunks(): Array<OutputChunk | OutputAsset> | undefined; | ||
} | ||
|
||
/** | ||
* A plugin that tracks and saves the output bundle for use when rendering the final manifest. | ||
*/ | ||
export function bundleTrackerPlugin(): BundleTrackerPlugin { | ||
let chunks: Array<OutputChunk | OutputAsset> | undefined; | ||
return { | ||
name: BUNDLE_TRACKER_PLUGIN_NAME, | ||
buildStart() { | ||
chunks = undefined; | ||
}, | ||
writeBundle(_, bundle) { | ||
chunks = Object.values(bundle); | ||
}, | ||
getChunks: () => chunks, | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const MANIFEST_LOADER_PLUGIN_NAME = `web-extension:manifest`; | ||
export const LABELED_STEP_PLUGIN_NAME = `web-extension:labeled-step`; | ||
export const MULTIBUILD_COMPLETE_PLUGIN_NAME = `web-extension:multibuild`; | ||
export const BUNDLE_TRACKER_PLUGIN_NAME = `web-extension:bundle-tracker`; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.