Code Monkey home page Code Monkey logo

Comments (3)

zzs1020 avatar zzs1020 commented on September 23, 2024

上课时老师说amd或cmd(以前)都是给前端用的规范,commonjs是给后端的,那现在前端用的规范是啥呢。现在都用import这个es6语法,可是这是不是叫做“es6规范”呢。用ts时有看到tsconfig.json文件里面会配置module:commonjs或者esnext,这些应该是去指定规范,可是文件里面还是都可以写import,难道commonjs也支持import了?

from 2019.03.

caihuiji avatar caihuiji commented on September 23, 2024

tsconfig.json 中 module 讲解如下:

target : "ES3" or "ES5" ? "CommonJS" : "ES6"
指定模块代码成:"None","CommonJS","AMD","System","UMD","ES6","ES2015"或"ESNext"。仅"AMD"和"System"可以一起使用--outFile。


ts写的代码,最终在不同环境运行(例如前端,node es5, node es6 ),所以这个时候module 要标明环境是 支持 commonjs 还是 esnext 还是 amd 。不然生成的代码不同是无法运行的
@zzs1020

from 2019.03.

zzs1020 avatar zzs1020 commented on September 23, 2024

@caihuiji 了解了 谢谢!

from 2019.03.

Related Issues (20)

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.