javascript - ES6 Module can directly import commonJS modules. Is this implemented directly in ES6, or is it implemented when converting to Babel?
習慣沉默
習慣沉默 2017-07-05 10:41:50
0
1
921

A package written in CommonJS specification, you can use it directly

import connect from 'connect'

Such a syntax introduction is implemented by ES6 Module or only implemented by Babel during translation

習慣沉默
習慣沉默

reply all(1)
滿天的星座

CommonJs modules must comply with the Commonjs specification, which is similar to the ES6 syntax, but is not equivalent to the ES6 specification.
import connect from 'connect' This is written in ES6 syntax. Currently, many browsers do not support ES6 syntax, so a converter is needed, such as Babel, which can convert ES6 syntax statements into ES5 and other syntax statements.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template