`The requested module '***/node_modules/sutando/sutando.js' does not provide an export named 'Model'`
jjjrmy opened this issue · comments
Jeremy Holstein commented
I just checked and you can npm run dev
fine on v1.2.1
but after switching to latest we get this error.
import { Model } from 'sutando';
this is throwing the error:
[worker reload] [worker init] The requested module '***/node_modules/sutando/sutando.js' does not provide an export named 'Model'
import { Model } from 'node_modules/sutando/sutando.js';
^^^^^
SyntaxError: The requested module 'node_modules/sutando/sutando.js' does not provide an export named 'Model'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
This is my setup:
// /sutando.config.ts
import ClientD1 from 'knex-cloudflare-d1';
export default {
client: ClientD1,
connection: {
database: process.env.DB,
},
migrations: {
table: 'migrations',
path: './database/migrations',
},
models: {
path: './models'
}
};
// /models/Prompt.ts
import { Model } from 'sutando';
export class Prompt extends Model {
// The table associated with the model.
table = 'prompts';
}
// /database/migrations/2024_04_13_create_prompts_table.ts
import { Migration } from 'sutando';
export default class extends Migration {
/**
* Run the migrations.
*/
async up(schema: any) {
await schema.createTable('prompts', (table: any) => {
table.increments('id');
table.timestamps();
});
}
/**
* Reverse the migrations.
*/
async down(schema: any) {
await schema.dropTableIfExists('prompts');
}
}