Closed
Description
-
var mod = require('mod');
=>- if
mod
is callable thenimport mod from 'mod'
- else
mod
is not callable theimport { a, b } from "mod"
and replacemod.a
andmod.b
- namespace import should ever be used?
- if
-
var mod= require('mod').a;
=>import { a } from "mod"
; -
const { a } = require('mod');
=>import { a } from "mod"
; -
if (__DEV__) { var warning = require('warning'); }
- disallowed?
- have two actions? one sync and one async?
-
function f() { var warning = require('warning'); }
=>async function f() { var warning = await import('warning'); }
- maybe do nothing here as well
-
module.exports = EventPlugin;
=>export default EventPlugin;
- fix imports in other files
- should we also fix
require("mod")
torequire("mod").default
?
-
module.exports.blah = 0
=>export const blah = 0
- should we support this too
var myModule = module.exports = exports = {}; myModule.a = 0;
- this is another common pattern in CJS modules that we should consider supporting
- we already have handling for this in the binder in .js files
- should we support this too
-
module.exports = require('mod');
=>export * from 'mod';
-
module.exports = {foo: function () { } ... }
=>export function foo() {}
?- is this even common enough to support?