File tree Expand file tree Collapse file tree 4 files changed +29
-25
lines changed Expand file tree Collapse file tree 4 files changed +29
-25
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,19 @@ export async function cssInContentScriptLoader(
99) {
1010 const manifestPath = path . join ( projectPath , 'manifest.json' )
1111
12- return [ {
13- test : / \. c s s $ / ,
14- type : 'asset' ,
15- generator : {
16- // Add contenthash to avoid naming collisions between
17- // different content script CSS files
18- filename : 'content_scripts/[name].[contenthash:8].css'
19- } ,
20- issuer : ( issuer : string ) => isContentScriptEntry ( issuer , manifestPath ) ,
21- use : await commonStyleLoaders ( projectPath , {
22- mode : mode as 'development' | 'production'
23- } )
24- } ]
12+ return [
13+ {
14+ test : / \. c s s $ / ,
15+ type : 'asset' ,
16+ generator : {
17+ // Add contenthash to avoid naming collisions between
18+ // different content script CSS files
19+ filename : 'content_scripts/[name].[contenthash:8].css'
20+ } ,
21+ issuer : ( issuer : string ) => isContentScriptEntry ( issuer , manifestPath ) ,
22+ use : await commonStyleLoaders ( projectPath , {
23+ mode : mode as 'development' | 'production'
24+ } )
25+ }
26+ ]
2527}
Original file line number Diff line number Diff line change @@ -9,13 +9,15 @@ export async function cssInHtmlLoader(
99) {
1010 const manifestPath = path . join ( projectPath , 'manifest.json' )
1111
12- return {
13- test : / \. c s s $ / ,
14- type : 'css' ,
15- // type: 'css' breaks content scripts so let's avoid it
16- issuer : ( issuer : string ) => ! isContentScriptEntry ( issuer , manifestPath ) ,
17- use : await commonStyleLoaders ( projectPath , {
18- mode : mode as 'development' | 'production'
19- } )
20- }
12+ return [
13+ {
14+ test : / \. c s s $ / ,
15+ type : 'css' ,
16+ // type: 'css' breaks content scripts so let's avoid it
17+ issuer : ( issuer : string ) => ! isContentScriptEntry ( issuer , manifestPath ) ,
18+ use : await commonStyleLoaders ( projectPath , {
19+ mode : mode as 'development' | 'production'
20+ } )
21+ }
22+ ]
2123}
Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ export class CssPlugin {
3737 // For HTML we need to use the css loader because it's a HTML file
3838 // and we need to load it as a CSS file.
3939 const loaders : RuleSetRule [ ] = [
40- await cssInContentScriptLoader ( projectPath , mode ) ,
41- await cssInHtmlLoader ( projectPath , mode )
40+ ... ( await cssInContentScriptLoader ( projectPath , mode ) ) ,
41+ ... ( await cssInHtmlLoader ( projectPath , mode ) )
4242 ]
4343
4444 // Add Sass/Less support if needed
Original file line number Diff line number Diff line change @@ -47,9 +47,9 @@ export default function webpackConfig(
4747 ? 'gecko-based'
4848 : devOptions . browser
4949
50+ // Keep hot updates for content scripts in development mode
5051 const cleanConfig = devOptions . output ?. clean
5152 ? devOptions . output . clean
52- // Keep hot updates for content scripts in development mode
5353 : devOptions . mode === 'development'
5454
5555 return {
You can’t perform that action at this time.
0 commit comments