Rename imported objects under the commonJS specification

We know that in ES6, the imported object can be renamed through as:

import {
    
     someModule as xxx }

But the commonJS syntax is used in node, and as is not allowed, we can do this:

const {
    
     someModule: xxx } = require('aaa/bbb/ccc')

Guess you like

Origin blog.csdn.net/dyw3390199/article/details/114134206