React Native仅导入所需内容

时间:2017-10-22 16:31:53

标签: reactjs react-native ecmascript-6

说我有以下内容:

validator.isEmail(txt)

并在我的代码中执行:

validator

是否会导入整个<html> <head> <title>Lorem ipsum</title> <link rel="stylesheet" type="text/css" href="Lorem ipsum.css" /> </head> <body> <div id="container"> <div id="title"> <h1>Lorem ipsum</h1> </div> <div id="main"> <div id="text"> <h2>Lorem ipsum</h2> <p><mark><em>Lorem ipsum</em></mark> dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> <h2>Lorem ipsum</h2> <p>"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is </p> <iframe width="560" height="315" src="https://www.youtube.com/embed/CBjij5QgzeE" frameborder="0" allowfullscreen></iframe> <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias "</p> <p>On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so </p> <h2>Lorem ipsum</h2> <p>"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, </p> <p>"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, no resultant pleasure?"</p> <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias </p> <h2>Lorem ipsum</h2> <p>"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system"</p> <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias "</p> <p>"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, no resultant pleasure?"</p> <h2>Lorem ipsum</h2> <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias."</p> </div> <div id="image"> <img src="Lorem ipsum.png" alt="Lorem ipsum" width="330" /> </div> </div> <div id="cuprins"> <table border="solid" > <th>Lorem ipsum</th> <th>Lorem ipsum</th> <th>Lorem ipsum</th> <th>Lorem ipsum</th> <th>Lorem ipsum</th> <th>Lorem ipsum</th> </table> </div> <div id="footer"> <q>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </q> </div> </div> </body> </html> 并增加整体包装尺寸?

如果,我该如何避免这种情况?

1 个答案:

答案 0 :(得分:3)

您的对帐单将导入整个验证程序。 你在找什么呢

    import { isEmail } from ‘validator’

isEmail应该在源文件中导出。