File tree Expand file tree Collapse file tree
packages/fxa-settings/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -664,6 +664,33 @@ module.exports = function (webpackEnv) {
664664 filename : 'static/css/[name].[contenthash:8].css' ,
665665 chunkFilename : 'static/css/[name].[contenthash:8].chunk.css' ,
666666 } ) ,
667+ isEnvProduction &&
668+ new ( class {
669+ apply ( compiler ) {
670+ compiler . hooks . compilation . tap (
671+ 'LinkTagRewritePlugin' ,
672+ ( compilation ) => {
673+ HtmlWebpackPlugin . getHooks ( compilation ) . alterAssetTagGroups . tap (
674+ 'LinkTagRewritePlugin' ,
675+ ( data ) => {
676+ data . headTags . forEach ( ( tag ) => {
677+ if (
678+ tag . tagName === 'link' &&
679+ tag . attributes . rel === 'stylesheet'
680+ ) {
681+ tag . attributes . rel = 'preload' ;
682+ tag . attributes . as = 'style' ;
683+ tag . attributes . onload =
684+ "this.onload=null; this.rel='stylesheet';" ;
685+ tag . attributes . crossorigin = 'anonymous' ;
686+ }
687+ } ) ;
688+ }
689+ ) ;
690+ }
691+ ) ;
692+ }
693+ } ) ( ) ,
667694 // Generate an asset manifest file with the following content:
668695 // - "files" key: Mapping of all asset filenames to their corresponding
669696 // output file so that tools can pick it up without having to parse
You can’t perform that action at this time.
0 commit comments