Open ksuprynowicz opened 11 months ago
If we integrate bounties as discussed in-world, I'd gladly fund this effort
Not sure if we should mix CommonJs and EsModules. In node.js there is a switch in package.json type: "module"
. If it is turned on, then the whole app must use import statements, any occurance of the require causes errors:
node index.js
file:///home/keeshii/repos/test-app/index.js:4
var fs = require('fs');
^
ReferenceError: require is not defined in ES module scope, you can use import instead
On the other hand, if we remove the type: module
from package.json, the import statements are not supported:
(node:5728) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/keeshii/repos/test-app/index.js:1
import { App } from './source/app.js';
https://v8docs.nodesource.com/node-18.16/df/d74/classv8_1_1_module.html https://nodejs.org/api/esm.html#modules-ecmascript-modules https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules