How can I rewrite a commonJS statement into an ECMAScript import when it uses consecutive requires on one line?

35 Views Asked by At

I am new to JavaScript for the most part and looking to convert this line into an import statement.

var sass = require('gulp-sass')(require('sass'));

I've already converted the other requires into imports but couldn't find an example of this syntax.

1

There are 1 best solutions below

0
danielRICADO On BEST ANSWER

it's just a nested require

var sass = require('gulp-sass')(
    require('sass')
);

should convert to something like

import sass from 'sass'
import gulpSass from 'gulp-sass'

var gulpSassInstance = gulpSass(sass)