The root of the problem lies in an issue with squel.js that hinders its functionality after it has been minified.
Solution (Workaround)
1) To address this issue, you can include sqlite as a script in your angular.json
file instead of using the import
method. Simply add it to the scripts
array under
projects.myAppName.architect.build.options
:
"scripts": [
"node_modules/squel/dist/squel.min.js"
]
Make sure to also add it to
projects.myAppName.architect.test.options
to ensure the unit tests run smoothly.
2) Although the production bundle is now functioning properly, we must fix the typings to ensure compatibility with the TypeScript compiler.
Since the import:
import * as squel from 'squel';
Has been removed, all types such as squel.Insert
will be incompatible.
To resolve this, add:
declare const squel: Squel & {flavour: null};
Now, the typings like squel.Insert
, squel.Delete
, etc., will be replaced by simply Insert
, Delete
, and so on. Don't forget to import them:
import { Squel, Delete, Insert } from 'squel';
This approach allows you to use import
solely for importing type definitions rather than the entire library.
Example
https://github.com/azerothcore/Keira3/commit/98f191eb59cf9c853dd8a54a845a029c7a4ddef8