Closed
Description
From @osya on May 21, 2018 8:59
- VSCode Version: 1.23.1
- OS Version: Windows 10 Pro x64
Steps to Reproduce:
- Create a file test_file.js with the following content:
var path = require('path');
(function () {
var path = require('path');
}());
Click lightbulb and select "Convert to ES6 module" then the 1st require
transforms to the import path from "path";
. It is correct. Then comment 1st require
and click lightbulb and select "Convert to ES6 module" for the 2nd require
. 2nd require
doesn't converted to the import path from "path";
. ES6 imports must be at the top level of your JavaScript files. So, I suppose, for require
in IIFE there should be NO option "Convert to ES6 module"
Copied from original issue: microsoft/vscode#50205