Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dart Runtime expects the entrypoint file to be inside lib folder #194

Closed
ItzNotABug opened this issue Sep 8, 2023 · 1 comment
Closed

Comments

@ItzNotABug
Copy link
Member

Previously on 1.3x the entry point file was allowed to be used in the root directory & it wasn't necessary that it should be inside lib directory.

However, on 1.4x function building fails.
Even the default path for the entry point is lib/main.dart if Platform.environment['OPEN_RUNTIMES_ENTRYPOINT'] is null.

If the entry point is in the root directory, the build fails with below error:

server.dart:5:8: Error: Error when reading 'lib/main.dart': No such file or directory
import 'package:packageName/main.dart' as user_code;
       ^
server.dart:107:25: Error: Method not found: 'main'.
              user_code.main(context)
                        ^^^^
server.dart:117:38: Error: Method not found: 'main'.
            output = await user_code.main(context);

Build works fine if the main.dart is inside the lib folder.


The error stems from here, I believe:

serv = serv.replaceAll('{entrypoint}', "package:$packageName/" + fileName);

Proposed solution:

  1. Add relevant info to docs to follow the standard Dart file structure convention
  2. Move the entry point inside the lib directory when building the function.
@ItzNotABug
Copy link
Member Author

Moved this issue to appwrite repository. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant