Giter Club home page Giter Club logo

own-webpack's Introduction

Bundlers let us write modules that works in a browser.

实现步骤:

1.解析单个文件并提取他的依赖 通过ast工具把代码转换为commonjs的代码,并提取依赖文件 2.递归构建依赖关系图 从入口文件开始,把所有文件的依赖关系创建出来 3,把所有文件打包成一个文件 把所有代码打包在一个自执行函数里。从入口文件开始执行,递归地把浏览器可以支持的“代码块”执行下去。 这里不得不夸一句babel-core的transformFromAst方法NB,直接把es6+的代码转换为浏览器可以直接执行的代码。

参考资料: https://www.youtube.com/watch?v=Gc9-7PBqOC8&list=LLHK1mTHpwrUeYgF5gu-Kd4g

own-webpack's People

Contributors

calali avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.