How do i write this require as an es6 import statement

前端 未结 3 1977
逝去的感伤
逝去的感伤 2020-12-20 01:56

Problem

I have this require statement

require(\'smoothscroll-polyfill\').polyfill();

But I would like to write it as an es6 impor

3条回答
  •  悲哀的现实
    2020-12-20 02:36

    using import {} from '...' instead.

     import {polyfill} from 'smoothscroll-polyfill';//ref polyfill from 'smotthscroll-polyfill'
     polyfill();//ref a method,so you must call it after imported.
    

提交回复
热议问题