Comments (3)
The issue is that the current main.php
that we generate when running the phel build
command is missing the autoload from vendor, therefore it doesn't know where to find the dependency classes. E.g:
Uncaught Error: Class "Phel\Lang\Registry" not found in ./temp/cli-skeleton/out/phel/core.php:3
An alternative solution for now: you can create a script yourself similar to what I did here: https://github.com/Chemaclass/phel-snake/blob/main/play.php
<?php declare(strict_types=1);
require_once __DIR__ . "/vendor/autoload.php";
$compiledFile = __DIR__ . "/out/phel_snake/main.php";
if (!file_exists($compiledFile)) {
echo 'Building the project...';
exec('vendor/bin/phel build --no-cache');
}
require_once $compiledFile;
With this script you are requiring the vendor/autoload
file and then calling your "main built entry point". So, instead of running the php out/cli_skeleton/main.php
you would run php main.php
, having something similar in your main.php
as I have in the play.php
. Does it make sense for you?
That said, this is an interesting observation that might need a rethink to avoid this work around all the time, and rather be something integrated as part of the "build" command. Therefore, we can agree that this is not a bug, but a "feature" that I will take a deeper look. Thanks for reporting it, @bentxt !
from phel-lang.
@bentxt I created a PR (#607) automating the creation of this template, so this will be part of the build command.
from phel-lang.
Already merged in the main branch. Here you have a demo:
Screen.Recording.2023-06-23.at.15.50.12.mov
from phel-lang.
Related Issues (20)
- Improve "You can not use this 'recur here" error message HOT 4
- Create constants for phel-config keys HOT 1
- Phel compile triggers I/O HOT 1
- Allow ignore phel files at compile time HOT 1
- Add __name__ to identify the execution of a script HOT 2
- Create int function HOT 2
- Add default format paths HOT 1
- require scope loads *build-mode* code HOT 5
- php/apush and php/aset not working as expected HOT 2
- CI does not fail when a phel test fails
- Language support in PhpStorm HOT 4
- Not able to execute generated php code HOT 4
- Add phel config file automatic after requiring phel
- NodeEnvironment error being thrown when calling `doc` in the REPL
- Some functions are missing in the API HOT 2
- Improve error messages in the REPL HOT 2
- Invalid build entry point
- Improve error reporting for deprecated notes
- First argument of 'ns must be a Symbol
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phel-lang.