Replies: 0 comments 4 replies
-
namespace ?// my-fs.mjs
function existsSync(path) {
console.log(`✅ path =`, path ?? `❌`)
}
const my_fs = {
existsSync,
};
export default my_fs;
export {
existsSync,
} // test.mjs
import my_fs from './my-fs.mjs';
// namespace ❓ node
// import node_fs from 'node:fs';
// import node_my_fs from './my-fs.mjs:existsSync';
import {existsSync} from './my-fs.mjs';
const log = console.log;
log(`\my_fs.existsSync =`, my_fs.existsSync)
log(`\my_fs:existsSync =`, existsSync)
// $ node ./test.mjs
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I think what you are trying to do is: // test.js
const my_fs = require('./my-fs')
const { existsSync } = require('./my-fs')
const log = console.log;
log(`\my_fs.existsSync =`, my_fs.existsSync)
log(`\my_fs:existsSync =`, existsSync) |
Beta Was this translation helpful? Give feedback.
0 replies
-
https://nodejs.org/api/esm.html#data-imports refs |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
demo
But it does not work, what's wrong with that?
refs
https://github.com/nodejs/node/blob/v19.0.1/lib/fs.js#L281
Beta Was this translation helpful? Give feedback.
All reactions