-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Hi @Macmee,
I have another suggestion. Looking at the replacements the hook function makes, I see a few incompatibilities/omissions compared to how 'real' ES6 modules would behave. You've probably already come across the MDN import and export pages, and Axel Rauschmayer eBook. Perhaps you could list which syntax is supported/unsupported in your README.
export default Xis not the same asmodule.exports = X. It actually creates an export named 'default'.import X from './X'is not the same asconst X = require('./X'), it's more likeconst X = require('./X').default(but see next point)- exported values can be modified by their exporting module, and all import sites will instantly see the updated value. E.g. if module A contains
export let x = 1; setTimeout(() => ++x, 1000);, and module B hasimport {x} from './A', then thexvariable in module B will change form 1 to 2 after a second. This allows ES6 modules to support circular references. - ES6 imports are hoisted.
- various ES6 syntaxes appear not to be supported here, e.g.:
import {foo as myFoo} from './module'import './module'import * as fs from 'fs'import main, {other, another} from './module'export default (/* absolutely any expression */)export {foo, bar}export {x} from './module'export {x as default} from './module'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels