thereisnogadi
WWasp-lang
•Created by thereisnogadi on 7/11/2024 in #đŸ™‹questions
Running into an issue with importing generated .wasp actions directory
I'm not sure why this happens, but seems like any time I modify the actions.js file or the function that invokes the action, I get this error on recompilation:
[ Server!] node:internal/modules/esm/resolve:259
[ Server!] throw new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base), String(resolved));
[ Server!] ^
[ Server!]
[ Server!] Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/gadicohen/2024/DreamProject/.wasp/out/sdk/wasp/dist/client/operations/actions' is not supported resolving ES modules imported from /Users/gadicohen/2024/DreamProject/.wasp/out/sdk/wasp/dist/client/operations/index.js
[ Server!] at finalizeResolution (node:internal/modules/esm/resolve:259:11)
..........
[ Server!] code: 'ERR_UNSUPPORTED_DIR_IMPORT',
[ Server!] url: 'file:///Users/gadicohen/2024/DreamProject/.wasp/out/sdk/wasp/dist/client/operations/actions'
[ Server!] }
[ Server!]
[ Server!] Node.js v20.15.1
[ Server ] [nodemon] app crashed - waiting for file changes before starting...
code:
// actions.js
import { HttpError } from 'wasp/server'
export const createStorybook = async ({ title }, context) => {
if (!context.user) { throw new HttpError(401) };
const newStorybook = await context.entities.Storybook.create({
data: {
title: title,
userId: context.user.id
}
});
return newStorybook;
}
// apis.ts
import { createStorybook } from 'wasp/client/operations';
...
const storybook = await createStorybook({ title: "My Storybook" });
---
I've tried
wasp clean
three times but am running into this issue every time.9 replies