Is your feature request related to a problem? Please describe.
Importing env variables is very simple right now
import { MyEnvVar } from "/env.js"
but in the case of Fable this causes certain issues: https://github.com/fable-compiler/Fable/issues/3146 mostly this just happens to be something that will exist at runtime, not at compile time so It should not be resolved by fable.
However even if this gets fixed in fable if we choose a longer path /path/to/my/env/file/env.js because of reasons only the users know, this will still pose long paths and requires us to know the whole path al of the time which once again, it is not ideal.
Describe the solution you'd like
I want to skip providing the absolute path import completely (this will also help us in the case of fable), I don't know where my mind has been, but we can use import maps for this purpose... I mean DUDE that's one of the main use cases for the feature 😅
With the following import map:
{
"imports": {
"react": "https://wherever.react-is-hosted-com/react",
// the rest of the dependencies
// Add an entry for the env file right here
"App:Environment": "/path/to/env/configured/in/perla-json/env.js"
}
}
We can just change the import to the following:
[<ImportMember("App:Environment")>]
let SERVER_URL = jsNative
import { SERVER_URL } from "App:Environment"
I'm not sure if I should make that bare import (App:Environment) configurable or just settle in that naming convention.
Describe alternatives you've considered
Keep this feature out
Is your feature request related to a problem? Please describe.
Importing env variables is very simple right now
but in the case of Fable this causes certain issues: https://github.com/fable-compiler/Fable/issues/3146 mostly this just happens to be something that will exist at runtime, not at compile time so It should not be resolved by fable.
However even if this gets fixed in fable if we choose a longer path
/path/to/my/env/file/env.js
because of reasons only the users know, this will still pose long paths and requires us to know the whole path al of the time which once again, it is not ideal.Describe the solution you'd like
I want to skip providing the absolute path import completely (this will also help us in the case of fable), I don't know where my mind has been, but we can use import maps for this purpose... I mean DUDE that's one of the main use cases for the feature 😅
With the following import map:
We can just change the import to the following:
I'm not sure if I should make that bare import (App:Environment) configurable or just settle in that naming convention.
Describe alternatives you've considered Keep this feature out
Additional context Discovered working in #104