Kyle Simpson
Kyle Simpson
reference: http://obscurejavascript.tumblr.com/post/134675242340/multicore-javascript-with-nodejs
RE: https://github.com/getify/import-remap/issues/1#issuecomment-1345722888 Currently, this CJS: ``` var { default: traverse, } = require("@babel/traverse"); ``` Transpiles to this ESM: ```js import traverse from "@babel/traverse"; ``` That seems technically correct. But In...
If you run moduloze on an empty file/files, and the produced output is also empty, this throws as an error (the object `{ code: "" }`) incorrectly.
```js module.exports.x = 2; module.exports.fn = fn; ``` currently becomes: ```js export { 2 as x }; export { fn }; ``` but should be: ```js export { 2 as...
This fails for some reason. ```js module.exports.foo = module.exports.bar = BAZ; ```
```js module.exports = { x: () => 42 }; module.exports.x(); ``` ```cmd mz -e // Error: Error: Multiple default exports not allowed in the same module (./test.js) ``` This error...
This kind of code: ```js var publicAPI = { something }; module.exports.something = publicAPI.something; function something() {} ``` ...is transpiled to ESM format as: ```js var publicAPI = { something...
Take inspiration from [some very clever re-naming logic in rollup](https://rollupjs.org/repl/?version=2.28.2&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMCU3QiUyMGhlbGxvJTIwYXMlMjBoMSUyMCU3RCUyMGZyb20lMjAlNUMlMjIuJTJGYS5qcyU1QyUyMiUzQiU1Q24lNUNuaW1wb3J0JTIwJTdCJTIwaGVsbG8lMjBhcyUyMGgyJTJDJTIwZm9vJTIwJTdEJTIwZnJvbSUyMCU1QyUyMi4lMkZiLmpzJTVDJTIyJTNCJTVDbiU1Q25oMSgpJTNCJTVDbmgyKCklM0IlNUNuY29uc29sZS5sb2coZjIpJTNCJTVDbmV4cG9ydCUyMCU3QiUyMGZvbyUyMCU3RCUzQiU1Q24lMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSU3RCUyQyU3QiUyMm5hbWUlMjIlM0ElMjJhLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMnZhciUyMGZvbyUyMCUzRCUyMDIlM0IlNUNuZXhwb3J0JTIwZnVuY3Rpb24lMjBoZWxsbygpJTIwJTdCJTIwY29uc29sZS5sb2coZm9vKSUzQiUyMCU3RCUyMiUyQyUyMmlzRW50cnklMjIlM0FmYWxzZSU3RCUyQyU3QiUyMm5hbWUlMjIlM0ElMjJiLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMnZhciUyMGZvbyUyMCUzRCUyMDMlM0IlNUNuZXhwb3J0JTIwZnVuY3Rpb24lMjBoZWxsbygpJTIwJTdCJTIwY29uc29sZS5sb2coZm9vKSUzQiUyMCU3RCU1Q25leHBvcnQlMjAlN0IlMjBmb28lMjAlN0QlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==) that handles collisions well: `main.js`: ```js import { hello as h1 } from "./a.js"; import { hello as h2, foo...
From: https://github.com/eight04/cjs-es#import-style > Note that if the identifier is used as the callee of a function/new expression, it would be considered as the default member since the namespace is not...
https://twitter.com/LeaVerou/status/1285320583408955401?s=20 Example: ```js var MyModule = { someData: 42, foo() { console.log(this.someData); } bar, }; function bar() { console.log(this.someData * 2); } ``` might become this (ESM): ```js var $exports$...