Error [ERR_UNSUPPORTED_DIR_IMPORT]
We're using a monorepo, where we have multiple resources in our packages/ui. Chartist, Melt, OpenTS, etc, which we're re-exporting so multiple apps can use same source. This works for all, but not for this projekt, and I cannot figure out why?
We get this problem:
Directory import '/frontend/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vincjo/datatables/dist/src/client' is not supported resolving ES modules.
Someone know how to fix this? What we essentially want to do, is in our packages/ui, have a component which re-exports @vincjo/datatables:
/packages/ui/components/table/index.ts:
export * from '@vincjo/datatables';
export type * from '@vincjo/datatables';
export { default as Table } from './table.svelte'
This table.svelte, is essentially then itself using the node module:
<script lang="ts">
import { TableHandler, Datatable, ThSort, ThFilter } from '@vincjo/datatables'
let { data } = $props();
const table = new TableHandler(data, { rowsPerPage: 10 })
</script>
<Datatable basic {table}>
This works with other packages, as mentioned.
I think the entry point should be "@vincjo/datatables/dist" instead of "@vincjo/datatables/dist/src/client"
Directory import '/frontend/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vincjo/datatables/dist/src/client' is not supported resolving ES modules.
There are exports in src/client but they are not intended for use outside of local development.
Thanks, but I'm only importing / exporting from @vincjo/datatables as you can see in my example above...
Just released a patch adding "/index.js" in internal imports -> 2.3.2
Hopefully this resolves the issue.
Sorry, It does not :(
Now I'm not even re-exporting anything, just using the table in my component, trying to import that component in one of my apps...
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/frontend/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vincjo/datatables/dist/src/client/TableHandler.svelte'