Stuyk / altv-athena

A Roleplay Framework for alt:V by Stuyk
https://athenaframework.com/
228 stars 149 forks source link

Every opensource plugin is not working from now on. Api importing error. #452

Closed CodeLit closed 1 year ago

CodeLit commented 1 year ago

Now after the update, plugins stopped working, because the import principle has changed. It is necessary to return backward compatibility for plugins to work.

image

For example, this code is from documentation:

import * as alt from 'alt-server';
import * as Athena from '@AthenaServer/api';

const PLUGIN_NAME = 'myPlugin';
Athena.systems.plugins.registerPlugin(PLUGIN_NAME, () => {
    alt.log('Hello from Athena Server!');
});

is not working, because we need to add index file in the end:

import * as alt from 'alt-server';
import * as Athena from '@AthenaServer/api/index.js';

const PLUGIN_NAME = 'myPlugin';
Athena.systems.plugins.registerPlugin(PLUGIN_NAME, () => {
    alt.log('Hello from Athena Server!');
});

Now code is works, and there is no error anymore.

Stuyk commented 1 year ago

This is normal behavior. See this post from the alt:V team back in February of 2023.

https://discord.com/channels/371265202378899476/585862696281571341/1079021033199243274

CodeLit commented 1 year ago

I'm closing the issue, but I still think there should be backwards compatibility.