mirror of
https://github.com/appy-one/acebase-server.git
synced 2026-05-24 22:01:28 -06:00
[PR #56] [MERGED] Fix Bundling Issues #59
Labels
No labels
bug
enhancement
feature request
pull-request
types
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/acebase-server#59
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/appy-one/acebase-server/pull/56
Author: @Azarattum
Created: 11/27/2022
Status: ✅ Merged
Merged: 12/5/2022
Merged by: @appy-one
Base:
master← Head:imports📝 Commits (4)
3e0764bfix imports for bundlinge7db944fix esm json import6cdb009fix environment detection97cd904trim without optional chaining📊 Changes
3 files changed (+8 additions, -16 deletions)
View changed files
📝
src/routes/meta-info.ts(+3 -10)📝
src/server.ts(+3 -5)📝
tsconfig.json(+2 -1)📄 Description
I use vite to bundle my project into a single file when building for production.
acebase-serveris currently not suitable for such builds.After some investigation, I found out that
swaggercompletely breaks in single-file builds. I thought it shouldn't be used in production mode. However, it's still gets bundled increasing file size by a factor for TWO! To solve this problem, I've changed docs imports to dynamic ones and simplified environment condition to be recognized by bundler. (I still needed to doreplace({"process.env.NODE_ENV": '"production"'})with@rollup/plugin-node-resolvethough...)The second problem was dynamically loaded
package.jsonfile which is obviously not present whenacebase-servermodule is embedded into an application. To solve this we can use JSON imports from Typescript. This way during bundling the JSON data will be inlined properly. Btw, I did a little hack with@ts-ignorethere because TypeScript got mad at the file not being at the source root (./src). It is still miles better that trying to loadpackage.jsonfrom the filesystem, and crashing if it's not present.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.