File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -3798,4 +3798,32 @@ describe("HtmlWebpackPlugin", () => {
3798
3798
done ,
3799
3799
) ;
3800
3800
} ) ;
3801
+
3802
+ it ( "allow you to use custom HTML tag attributes in templates" , ( done ) => {
3803
+ testHtmlPlugin (
3804
+ {
3805
+ mode : "production" ,
3806
+ entry : path . join ( __dirname , "fixtures/index.js" ) ,
3807
+ output : {
3808
+ path : OUTPUT_DIR ,
3809
+ filename : "index_bundle.js" ,
3810
+ } ,
3811
+ plugins : [
3812
+ new HtmlWebpackPlugin ( {
3813
+ template : path . join ( __dirname , "fixtures/template.ejs" ) ,
3814
+ baseHref : "/" ,
3815
+ minify : false ,
3816
+ appMountIds : [ "react-app" , "portal-root" ] ,
3817
+ favicon : path . join ( __dirname , "fixtures/favicon.ico" ) ,
3818
+ inject : false ,
3819
+ } ) ,
3820
+ ] ,
3821
+ } ,
3822
+ [
3823
+ / < s c r i p t s r c = " i n d e x _ b u n d l e .j s " t y p e = " t e x t \/ j a v a s c r i p t " n o n c e = " N O N C E " > < \/ s c r i p t > / ,
3824
+ ] ,
3825
+ null ,
3826
+ done ,
3827
+ ) ;
3828
+ } ) ;
3801
3829
} ) ;
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ <html >
3
+ <head ></head >
4
+ <body >
5
+ <div id =" react-app" ></div >
6
+ <% for (item of htmlWebpackPlugin .files .js ) { % >
7
+ < % if (typeof item === ' string' || item instanceof String ) {
8
+ item = { src: item, type: ' text/javascript' }
9
+ } % >
10
+ < script< % for (key in item) { % > < %= key % >= " <%= item[key] %>" < % } % > nonce= " NONCE" >< / script>
11
+ < % } %>
12
+ </body >
13
+ </html >
You can’t perform that action at this time.
0 commit comments