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
[Angular] Core Package Should Be a Bundled Dependency
Situation
@fusionauth-sdk/core is a dependency of the three SDKs (React, Angular, Vue). We are using a monorepo to manage these SDKs because they share this framework-agnostic core logic.
Problem
We want to bundle the core package with each SDK for distribution since it's not listed on the npm registry. We use Vite to do this for React and Vue. Angular is slightly different in that @angular-devkit/build-angular:ng-packagr—the builder for Angular libraries—doesn't support bundling dependencies whose source code lives outside the Angular workspace. We've not been able to find a compatible way to bundle the core package into the Angular SDK for distribution.
Solution
Copy the core package src directory into the Angular package without transpiling it and allow Angular's library builder to handle the rest as if it's not an external dependency. The Angular SDK will use relative paths to import the core module from the copied directory.
A script get-sdk-core from the Angular SDK package.json copies it into a git-ignored directory packages/sdk-angular/projects/fusionauth-angular-sdk/src/sdkcore. When developing/debugging, changes should not be made to the git-ignored directory; they should be made in packages/core and then consumed with get-sdk-core.
Drawbacks
Drawbacks of this approach include:
We can't use absolute paths within the core package.
It may be confusing to new developers on the project. We should add documentation that clarifies why this decision was made.
Alternate Solution
Publish the @fusionauth-sdk/core and allow SDKs to consume it as a non-bundled dependency.
Drawbacks
Another set of public documentation to maintain.
Adding another publishing cycle/versioning for the dependency.
The text was updated successfully, but these errors were encountered:
[Angular] Core Package Should Be a Bundled Dependency
Situation
@fusionauth-sdk/core
is a dependency of the three SDKs (React, Angular, Vue). We are using a monorepo to manage these SDKs because they share this framework-agnostic core logic.Problem
We want to bundle the core package with each SDK for distribution since it's not listed on the npm registry. We use Vite to do this for React and Vue. Angular is slightly different in that
@angular-devkit/build-angular:ng-packagr
—the builder for Angular libraries—doesn't support bundling dependencies whose source code lives outside the Angular workspace. We've not been able to find a compatible way to bundle the core package into the Angular SDK for distribution.Solution
Copy the core package
src
directory into the Angular package without transpiling it and allow Angular's library builder to handle the rest as if it's not an external dependency. The Angular SDK will use relative paths to import the core module from the copied directory.A script
get-sdk-core
from the Angular SDKpackage.json
copies it into a git-ignored directorypackages/sdk-angular/projects/fusionauth-angular-sdk/src/sdkcore
. When developing/debugging, changes should not be made to the git-ignored directory; they should be made inpackages/core
and then consumed withget-sdk-core
.Drawbacks
Drawbacks of this approach include:
Alternate Solution
Publish the
@fusionauth-sdk/core
and allow SDKs to consume it as a non-bundled dependency.Drawbacks
The text was updated successfully, but these errors were encountered: