You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No matching export in "@app-config/esbuild:@app-config/main" for import "loadConfig"聽#208
UPDATE (but please see next comment!)
Ok, I realize my mistake now. 馃槼
I just understood that by default the esbuild plugin will bundle (inline) the configuration files and there's no need to use loadConfig anymore. My initial impression was that the plugin was needed to provide some compatibility with esbuild and solve some bundling problem (like the one I mention on the next comment).
This should be more clear in the docs. I only realized it because I was going through the esbuild plugin source code and I found it has an undocumented options object where noBundledConfig = false.
Hello.
I'm trying to use the esbuild plugin, but I'm getting the following error during build:
I obviously need to call loadConfig somewhere in my application to load the config files.
Changing to import loadConfig from '@app-config/main'; (without brackets) won't throw a build error, but the code obviously won't work, as it now thinks that loadConfig is the same as config (ExportedConfig), which is not a function!
One more thing to note here, you have a dependency on openpgpjs 4.x, which has a problem with bundlers.
When I bundle my application (without the plugin) and try to run it on AWS Lambda (node 16) I get this error:
I've primarily worked on the esbuild plugin for web apps, so noBundledConfig was largely just there for completeness. This documentation definitely could be improved.
We should be able to upgrade openpgp as well, hopefully without breaking changes.
I believe this would necessitate a breaking change in app-config's API, unfortunately, because we do re-export Key in a couple places. Right now we lock all subpackages to the same version, so it would mean a v3 (#130).
I believe this would necessitate a breaking change in app-config's API, unfortunately, because we do re-export Key in a couple places. Right now we lock all subpackages to the same version, so it would mean a v3 (#130).
Understood! I can live with my workaround right now since I'm not using encrypted config properties.
On a side note, I'd like to leave a suggestion for maybe putting all the encryption functionality on a separate package.
If you don't need encryption, it will "pollute" your bundle, bringing in some heavy dependencies.
Check this report from bundle-buddy.com for my application:
openpgp and node-forge are responsible for half of my bundle size and I'm not even using them.
On a side note, I'd like to leave a suggestion for maybe putting all the encryption functionality on a separate package.
If you don't need encryption, it will "pollute" your bundle, bringing in some heavy dependencies.
For sure! This is a core goal of the theoretical V3 already. Encryption is a separate package, but it was included as a "default" parsing extension, so it's included in bundles at the moment. A big part of V3 is to remove more default extensions, letting users choose what they want.
I'm also encountering the same error No matching export in "@app-config/esbuild:@app-config/main" for import "loadConfig". noBundledConfig doesn't change the behavior regardless if set to true or false.
Aside from adding the plugin to the esbuild script, is there something else I'm missing?
If we aren't suppose to use loadConfig how would I make the code work in both bundled and unbundled environments?
Created a PR (#231) that adds loadConfig to the exports for generated code when bundling. The exported function is simply an auto resolve promise (to keep the same interface as normal usage) that will return the config.
Activity
danielsitnik commentedon Aug 11, 2022
One more thing to note here, you have a dependency on openpgpjs 4.x, which has a problem with bundlers.
When I bundle my application (without the plugin) and try to run it on AWS Lambda (node 16) I get this error:
This is mentioned in some issues like this and also this one from the official openpgpjs repo.
They fixed it on version 5.x, so I appreciate if you could update your version as well!
I just tested it with an override on my package.json and it worked liked a charm on AWS Lambda:
joelgallant commentedon Aug 11, 2022
Thanks for the report!
I've primarily worked on the esbuild plugin for web apps, so
noBundledConfigwas largely just there for completeness. This documentation definitely could be improved.We should be able to upgrade openpgp as well, hopefully without breaking changes.
joelgallant commentedon Aug 12, 2022
Release notes: https://github.com/openpgpjs/openpgpjs/releases/tag/v5.0.0
I believe this would necessitate a breaking change in app-config's API, unfortunately, because we do re-export
Keyin a couple places. Right now we lock all subpackages to the same version, so it would mean a v3 (#130).danielsitnik commentedon Aug 18, 2022
Understood! I can live with my workaround right now since I'm not using encrypted config properties.
On a side note, I'd like to leave a suggestion for maybe putting all the encryption functionality on a separate package.
If you don't need encryption, it will "pollute" your bundle, bringing in some heavy dependencies.
Check this report from bundle-buddy.com for my application:

openpgp and node-forge are responsible for half of my bundle size and I'm not even using them.
joelgallant commentedon Aug 18, 2022
For sure! This is a core goal of the theoretical V3 already. Encryption is a separate package, but it was included as a "default" parsing extension, so it's included in bundles at the moment. A big part of V3 is to remove more default extensions, letting users choose what they want.
NJKruczek commentedon Dec 7, 2024
I'm also encountering the same error
No matching export in "@app-config/esbuild:@app-config/main" for import "loadConfig".noBundledConfigdoesn't change the behavior regardless if set totrueorfalse.Aside from adding the plugin to the esbuild script, is there something else I'm missing?
If we aren't suppose to use
loadConfighow would I make the code work in both bundled and unbundled environments?NJKruczek commentedon Dec 26, 2024
Created a PR (#231) that adds
loadConfigto the exports for generated code when bundling. The exported function is simply an auto resolve promise (to keep the same interface as normal usage) that will return the config.