Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

189 - webpack打包时怎么给script标签加上async、defer属性? #189

Open
bettersong opened this issue Apr 19, 2022 · 0 comments
Open
Labels

Comments

@bettersong
Copy link
Owner

bettersong commented Apr 19, 2022

可以使用html-webpack-pluginscript-ext-html-webpack-plugin插件来进行配置
对 <script> 标签添加 async,defer,module 属性,或者内联这些属性

plugins: [
  new HtmlWebpackPlugin(),
  new ScriptExtHtmlWebpackPlugin({
    defaultAttribute: 'async'
  })
]  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant