When using the main entry file, some imports are missing a file extension. This leads to problems if you don't use a bundler.
This is working fine:
import * as environment from 'lib0/environment.js'
But this fails:
import { environment } from 'lib0'
Error:
node:internal/process/esm_loader:74
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/philippkuehn/Projekte/lib0test/node_modules/lib0/environment' imported from /Users/philippkuehn/Projekte/lib0test/node_modules/lib0/index.js
at new NodeError (node:internal/errors:258:15)
at finalizeResolution (node:internal/modules/esm/resolve:276:11)
at moduleResolve (node:internal/modules/esm/resolve:699:10)
at Loader.defaultResolve [as _resolve] (node:internal/modules/esm/resolve:810:11)
at Loader.resolve (node:internal/modules/esm/loader:85:40)
at Loader.getModuleJob (node:internal/modules/esm/loader:229:28)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:51:40)
at link (node:internal/modules/esm/module_job:50:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
error Command failed with exit code 1.
I’m using node 15.0.1.
When using a bundler this should be fine but in my case I’m just running a script with node index.js.
With the PR, it works as expected.
When using the main entry file, some imports are missing a file extension. This leads to problems if you don't use a bundler.
This is working fine:
import * as environment from 'lib0/environment.js'
But this fails:
import { environment } from 'lib0'
Error:
I’m using node 15.0.1.
When using a bundler this should be fine but in my case I’m just running a script with
node index.js
. With the PR, it works as expected.