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

HTML attribute mark #22

Open
2zH opened this issue May 23, 2018 · 1 comment
Open

HTML attribute mark #22

2zH opened this issue May 23, 2018 · 1 comment

Comments

@2zH
Copy link
Owner

2zH commented May 23, 2018

No description provided.

@2zH
Copy link
Owner Author

2zH commented May 23, 2018

script[type="module"] script[nomodule]

<script type="module" src="xxx.js"></script>
<script nomodule src="xxx.legacy.js"></script>

支持 <script type="module"> 的浏览器,会识别 nomodule 属性,会自动忽略未使用 ES module 的代码。

不支持 <script type="module"> 的浏览器,会忽略加载带 type="module" 的 script 标签。同时也会忽略 nomodule 属性,直接加载未使用 ES module 标准的代码。

  • 在 HTML 内实现 Loading 态或者骨架屏;
  • 去掉外联 css;
  • 缓存基础框架;
  • 使用动态 polyfill;
  • 使用 SplitChunksPlugin 拆分公共代码;
  • 正确地使用 Webpack 4.0 的 Tree Shaking;
  • 使用动态 import,切分页面代码,减小首屏 JS 体积;
  • 编译到 ES2015+,提高代码运行效率,减小体积;
  • 使用 lazyload 和 placeholder 提升加载体验。

from: https://zhuanlan.zhihu.com/p/37148975

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant