AngelMunoz / Perla

A cross-platform tool for unbundled front-end development that doesn't depend on Node or requires you to install a complex toolchain
https://perla-docs.web.app/
MIT License
132 stars 11 forks source link

env.js is not created #104

Closed nojaf closed 1 year ago

nojaf commented 1 year ago

Describe the bug Hi, I'm still not entirely out of the woods for Telplin. The envPath file is not being created after running dotnet perla b.

To Reproduce See https://github.com/nojaf/telplin

My config does seem to work for dotnet perla s.

Any ideas?

AngelMunoz commented 1 year ago

beta 15 includes the changes required for telplin env (and also for fantomas-tools) that should make it work as we'd expect it in telplin to work.

I will make some ergonomic centered changes around the env imports for beta 16/17

Since we've been hitting a lot of issues with Fable's absolute path imports I want to skip that completely, I don't know where my mind has been but we can use import maps for this purpose...

With the following import map:

{
  "imports": {
    "react": "https://esm.sh/react",
    // the rest of the dependencies
    // Add an entry for the env file right here
    "App:Environment": "/env.js"
  }
}

We can just change the import to the following:

[<ImportMember("App:Environment")>]
let SERVER_URL = jsNative
import { SERVER_URL } from "App:Environment"

It will work cleanly, and we can avoid relying in fable's resolution rules I'm not sure if I should make that bare import (App:Environment) configurable or just settle in that naming convention

Anyways I'll open a different issue to track that, I'll close this issue as it should have been resolved, but if it doesn't feel free to let me know and we can re-open this

(by the way as an extra note... beta15 doesn't have dotnet perla s available, I'm waiting on https://github.com/JordanMarr/FSharp.SystemCommandLine/pull/15 to add it back in the proper manner)