# Accessing engine stores from plugins?

**URL:** <https://narrat.discourse.group/t/accessing-engine-stores-from-plugins/199>\
**Category:** Help\
**Created:** [22 April 2024 10:09 UTC](https://narrat.discourse.group/t/accessing-engine-stores-from-plugins/199 "2024-04-22T10:09:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ParanormalInstigator](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@ParanormalInstigator](https://narrat.discourse.group/u/ParanormalInstigator)\
**Post date:** [22 April 2024 10:09 UTC](https://narrat.discourse.group/t/accessing-engine-stores-from-plugins/199/1 "2024-04-22T10:09:41Z")

</div>

Attempting to build a stat assignment/character build screen using a custom plugin. I will admit I am new to typescript and pina and more advanced javascript programming in general. I’m a database guy whose done some front end javascript, so I’m out of my depth but trying to learn by the sink or swim method.

When I attempt to import a constant to execute its methods (in this case, to get and modify skill values) I get this error:

–

[plugin:vite:import-analysis] Failed to resolve import “…/node\_modules/narrat/dist/stores/skills” from “src\counter-ui.vue”. Does the file exist?

E:/narrat/narrat-game/src/counter-ui.vue:7:26

1 | import { computed, defineComponent } from “vue”;  
2 | import { useCounter } from “./custom-stores/counter-store”;  
3 | import { useSkills } from “…/node\_modules/narrat/dist/stores/skills”;  
| ^  
4 | const \_sfc\_main = defineComponent({  
5 | setup() {

```
at formatError (file:///E:/narrat/narrat-game/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:44062:46)
at TransformContext.error (file:///E:/narrat/narrat-game/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:44058:19)
at normalizeUrl (file:///E:/narrat/narrat-game/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:41844:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///E:/narrat/narrat-game/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:41998:47
at async Promise.all (index 2)
at async TransformContext.transform (file:///E:/narrat/narrat-game/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:41914:13)
at async Object.transform (file:///E:/narrat/narrat-game/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:44352:30)
at async loadAndTransform (file:///E:/narrat/narrat-game/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:55026:29)
at async viteTransformMiddleware (file:///E:/narrat/narrat-game/node_modules/vite/dist/node/chunks/dep-41cf5ffd.

```

–

Is accessing the engine stores from a plugin even possible or am I barking up the wrong tree.

---

<div class="post-metadata">

**Author:** ![Narrat-Admin](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/narrat-admin/32/429_2.png) [@Narrat-Admin](https://narrat.discourse.group/u/Narrat-Admin)\
**Post date:** [22 April 2024 12:49 UTC](https://narrat.discourse.group/t/accessing-engine-stores-from-plugins/199/2 "2024-04-22T12:49:05Z")

</div>

You shouldn’t import file paths directly from node modules, it won’t work, especially with typescript.

You can only import what’s exported by narrat. I think I’ve put stores in the exports list but not sure.

So this should work:

`import { useSkills } from 'narrat';`

You can also see all the exports in this folder: [narrat-engine/packages/narrat/src/exports at main · liana-p/narrat-engine · GitHub](https://github.com/liana-p/narrat-engine/tree/main/packages/narrat/src/exports)

exports.ts exports the other files in there which themselves export a bunch of narrat things, that can all be imported from narrat

---

<div class="post-metadata">

**Author:** ![ParanormalInstigator](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@ParanormalInstigator](https://narrat.discourse.group/u/ParanormalInstigator)\
**Post date:** [22 April 2024 15:01 UTC](https://narrat.discourse.group/t/accessing-engine-stores-from-plugins/199/3 "2024-04-22T15:01:05Z")

</div>

> [@Narrat-Admin](#):
>
> Import { useSkills } from ‘narrat’;

That did the trick, thank you! 😃 Appreciate the instruction. Still trying to wrap my head around the data structure.

> [@Narrat-Admin](#):
>
> exports.ts exports the other files in there which themselves export a bunch of narrat things, that can all be imported from narrat

Ah! There it is! I was looking everywhere for these hooks.

Thanks again! And thanks for making this engine, its really cool!
