GithubHelp home page GithubHelp logo

simple-vite's Introduction

simple-vite

vite的出现是因为浏览器已经支持了type=“module”,也就是es module,也就是import export语法,但是他读不懂我们写在文件里的相对路径那种。 我们需要做的是起一个koa服务器,前端需要啥代码,我返回给他 但是返回js的时候做import做一下特殊处理,因为import模块 的时候路径要改成node_modules里拿。所以用户那拿到的都是’/@modeules/’的路径,我们就再用koa处理一下,返回正确文件。浏览器解析type=“module”的js,遇到import就会自动向koa服务器以那个新路径再次请求,也就实现了按需请求加载。 做完上面的index.html里引入入口js就好了。

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.