File tree Expand file tree Collapse file tree 5 files changed +190
-160
lines changed
packages/rsbuild-plugin-web-extension/src Expand file tree Collapse file tree 5 files changed +190
-160
lines changed Original file line number Diff line number Diff line change 1717 "typescript" : " ^5.8.3"
1818 },
1919 "peerDependencies" : {
20- "tsup" : " 8.5.0" ,
21- "@rsbuild/core" : " 1.4.9" ,
20+ "@rsbuild/core" : " 1.4.10" ,
2221 "typescript" : " 5.8.3"
2322 },
2423 "packageManager" : " pnpm@10.13.1"
Original file line number Diff line number Diff line change 1- import { type RsbuildPlugin , rspack } from "@rsbuild/core" ;
2- import ManifestParser from "./manifest/parser .js" ;
1+ import { type RsbuildPlugin } from "@rsbuild/core" ;
2+ import { makeManifest } from "./manifest/make-manifest .js" ;
33
44interface Options {
55 manifest : chrome . runtime . ManifestV3 ;
@@ -80,28 +80,8 @@ export const pluginWebExtension = ({ manifest }: Options): RsbuildPlugin => ({
8080 } ) ;
8181 } ) ;
8282
83- api . onAfterCreateCompiler ( ( { compiler } ) => {
84- if ( ! ( compiler instanceof rspack . Compiler ) ) {
85- return ;
86- }
87-
88- compiler . hooks . thisCompilation . tap ( pluginName , ( compilation ) => {
89- compilation . hooks . processAssets . tap (
90- {
91- name : pluginName ,
92- stage : rspack . Compilation . PROCESS_ASSETS_STAGE_ADDITIONAL ,
93- } ,
94- ( ) => {
95- const content = ManifestParser . convertManifestToString ( manifest ) ;
96-
97- const { RawSource } = compiler . webpack . sources ;
98-
99- const source = new RawSource ( content ) ;
100-
101- compilation . emitAsset ( "manifest.json" , source ) ;
102- }
103- ) ;
104- } ) ;
83+ api . onAfterBuild ( ( ) => {
84+ makeManifest ( manifest , api . context . distPath ) ;
10585 } ) ;
10686 } ,
10787} ) ;
Original file line number Diff line number Diff line change 11import * as fs from "node:fs" ;
22import { resolve } from "node:path" ;
3- import { logger } from "@rsbuild/core" ;
43import ManifestParser from "./parser.js" ;
54
65export const makeManifest = (
@@ -18,5 +17,5 @@ export const makeManifest = (
1817 ManifestParser . convertManifestToString ( manifest )
1918 ) ;
2019
21- logger . log ( "Manifest file created" ) ;
20+ console . log ( "Manifest file created" ) ;
2221} ;
You can’t perform that action at this time.
0 commit comments