Don't think there is any sense to put here other files content.
It fails when I run node src/app.js due to services are imported with require() statement.
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/anton/Projects/patterns-js/patterns/lesson_06/homework_06/src/car.js from /Users/anton/Projects/patterns-js/patterns/lesson_06/homework_06/node_modules/node-dependency-injection/dist/lib/Loader/FileLoader.js not supported.
Instead change the require of car.js in /Users/anton/Projects/patterns-js/patterns/lesson_06/homework_06/node_modules/node-dependency-injection/dist/lib/Loader/FileLoader.js to a dynamic import() which is available in all CommonJS modules.
If I change all files from ES modules to CommonJS, and remove "type": "module" in package.json all works fine. But it is disappointing cause your docs full of examples written as ES modules.
Have small educational example for initial exploration of DI.
Don't think there is any sense to put here other files content.
It fails when I run
node src/app.js
due to services are imported withrequire()
statement.If I change all files from ES modules to CommonJS, and remove
"type": "module"
in package.json all works fine. But it is disappointing cause your docs full of examples written as ES modules.