Importing another table from another drizzle schema file (both are sqliteTable()) using
import { users as dataspaceUsers } from '../dataspace/index.js';
fails unless I remove the /index.js like:
import { users as dataspaceUsers } from '../dataspace';
which then works as expected when running drizzle-kit generate. But this breaks the schema file when being imported to be used by drizzle-orm normally at runtime:
Uncaught Error Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '<redacted>\dist\schemas\dataspace' is not supported resolving ES modules imported from <redacted>\dist\schemas\tenant\index.js
which is fixable by keeping the full path:
import { users as dataspaceUsers } from '../dataspace/index.js';
Expected behavior
I use the
import { users as dataspaceUsers } from '../dataspace/index.js';
and the import resolves as expected both during drizzle-kit and drizzle-orm runtime
Environment & setup
drizzle-kit is ran using exec() inside a node.js script that is ran in GitHub actions as part of overall project ci/cd to do automated migrations.
drizzle-orm using that schema is at regular runtime being used either in node.js environment or cloudflare workers environment.
What version of
drizzle-orm
are you using?0.31.1
What version of
drizzle-kit
are you using?0.22.2
Describe the Bug
Importing another table from another drizzle schema file (both are
sqliteTable()
) usingfails unless I remove the
/index.js
like:which then works as expected when running
drizzle-kit generate
. But this breaks the schema file when being imported to be used bydrizzle-orm
normally at runtime:which is fixable by keeping the full path:
Expected behavior
I use the
and the import resolves as expected both during
drizzle-kit
anddrizzle-orm
runtimeEnvironment & setup
drizzle-kit
is ran usingexec()
inside a node.js script that is ran in GitHub actions as part of overall project ci/cd to do automated migrations.drizzle-orm
using that schema is at regular runtime being used either in node.js environment or cloudflare workers environment.