Open zhuzhuaicoding opened 8 years ago
fis.match('::package', { spriter: fis.plugin('csssprites'), postpackager: fis.plugin('loader', { allInOne: { includeAsyncs: true, js: function(file) { return "static/" + file.filename + ".js"; }, css: function(file) { return "static/" + file.filename + ".css"; }, sourceMap: true //是否生成依赖map文件 }, resourcemapWhitespace: 4 }) })
test.html
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Description" content="" /> <meta name="Keywords" content="" /> <title>数据门户</title> </head> <body> <div class="wrapper" id='main_top'> <div class="pub_box"> <div class="pub_box_t"> <h2>批量添加</h2> <div class="title_right_box"><a class="batch_add_demo" href="/ch/download/manager/pcwap_cid.xlsx">下载模版</a></div> </div> <div class="pub_box_c batch_add"> <iframe id="iframe_upload_box" width="0" height="0" style="display: none" name="iframe_upload_box" src=""> <html> <head></head> <body></body> </html> </iframe> </div> </div> </div> <script> require.async(['app.js']) </script> </body> </html>
output
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Description" content="" /> <meta name="Keywords" content="" /> <title>数据门户</title> </head> <body> <div class="wrapper" id='main_top'> <div class="pub_box"> <div class="pub_box_t"> <h2>批量添加</h2> <div class="title_right_box"><a class="batch_add_demo" href="/ch/download/manager/pcwap_cid.xlsx">下载模版</a></div> </div> <div class="pub_box_c batch_add"> <iframe id="iframe_upload_box" width="0" height="0" style="display: none" name="iframe_upload_box" src=""> <html> <head>undefined <body> <script> require.async(['app.js']) </script> </body> </html> </iframe> </div> </div> </div> undefined </html>
为啥我的脚本跑到iframe里面去了呢?
没人解决吗? 好像是跟body标签有关,我的模板碎片里没有body,产出没有js引用
没有 body 标签的自己加 placeholder 。 https://github.com/fex-team/fis3-postpackager-loader/blob/master/index.js#L117-L125
楼主的问题应该也能用这个方式解决。
test.html
output
为啥我的脚本跑到iframe里面去了呢?