In the browser folder the package also includes a version compiled as a ES2015 module. If you want to use a different loader this is the point to start. Prior to TypeORM 0.1.7, the package is setup in a way that loaders like webpack will automatically use the browser folder. With 0.1.7 this was dropped to support Webpack usage in Node.js projects. This means, that the NormalModuleReplacementPlugin has to be used to insure that the correct version is loaded for browser projects. The configuration in your webpack config file, for this plugin looks like this:
plugins: [...,// any existing plugins that you already havenewwebpack.NormalModuleReplacementPlugin(/typeorm$/,function(result){result.request=result.request.replace(/typeorm/,"typeorm/browser");}),newwebpack.ProvidePlugin({'window.SQL':'sql.js/dist/sql-wasm.js'})]
In your main html page, you need to include reflect-metadata:
Cordova / PhoneGap / Ionic apps
TypeORM is able to run on Cordova, PhoneGap, Ionic apps using the cordova-sqlite-storage plugin You have the option to choose between module loaders just like in browser package. For an example how to use TypeORM in Cordova see typeorm/cordova-example and for Ionic see typeorm/ionic-example. Important: For use with Ionic, a custom webpack config file is needed! Please checkout the example to see the needed changes.
tns install webpack (read below why webpack is required)
tns plugin add nativescript-sqlite
Create Database connection in your app's entry point
Note: This works only with NativeScript 4.x and above
When using with NativeScript, using webpack is compulsory. The typeorm/browser package is raw ES7 code with import/export which will NOT run as it is. It has to be bundled. Please use the tns run --bundle method