Skip to content
@module-packer

module bundler

工具链

https://rust-analyzer.github.io/

brew install rustup-init

rustc -V 

rustc --explain E0423

cargo new <project_name>

类型兼容性

const PI:f64 = 3.141_592_653_59;


fn main() {
  let username:&str = "soetas";
  let mut stars:usize = 789;

  let is_male:bool = false;
  let is_male:&str = "yes";

  static LICENSE:&'static str = "BSD";

  let language = String::from("rust");
  let account:(&str, &str) = ("soetas", "3228891558@qq.com");
  let (username, email) = account;

  let status_code = 500;
  let status_text = match status_code {
      200 => "Ok",
      201 => "Created",
      302 => "Found",
      404 => "Not Found",
      500 => "Internal Server Error",
      _ => "Other"
  };

  let colors = vec!["pink", "orange", "skyblue", ];
  let languages:[&str;3] = ["rust", "go", "python",];

  for i in 0..=10 {
      println!("{}", i);
  }
  
  for color in colors.iter() {
      println!("{}", color);
  }

  loop {
    
  }


  // macro  
  println!("");
  

}

第一性原则

Webpack

增量构建

自动化测试、构建和部署

  • 源码压缩混淆
  • JS版本兼容性
  • Source Map([inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map
  • 持久化缓存
  • 并行构建
  • 缓存优化二次构建
  • 模块热替换(HMR)和热加载
  • 代码分离
  • 预获取和预加载
if(module.hot) {
  module.hot.accept('', ()=>{

  })
}
<link rel="prefetch" as="script" href="http://localhost:8080/share.bundle.js">
curl 

wget

npm i speed-measure-webpack-plugin thread-loader webpack-bundle-analyzer -D

npm i node-gyp -g

git diff --name-only

构建产物优化:

  • 代码分割(code split)
  • polyfill
  • 分包
  • 移除死代码(tree shaking)
  • 资源压缩
  • 外链CDN
  • 公共模块构建

Module Federation

雅虎军规

<script cross-origin="false" src=""></script>

chunkhashcontenthash

https://terser.org/

UMD模块化解决方案

Rollup

Vite

monorepo软件开发策略

npm i treer -g

前端交互解耦(FDD)

Popular repositories Loading

  1. .github .github Public

Repositories

Showing 1 of 1 repositories
  • .github Public
    module-packer/.github’s past year of commit activity
    0 0 0 0 Updated Sep 30, 2024

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…