Question: Electron + TypeORM + Webpack UglifyJsPlugin
See original GitHub issueIssue type:
[X] question [ ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[X] sqlite
[ ] sqljs
[ ] react-native
TypeORM version:
[X] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
I’m setting up my connection like this:
import { Table1 } from '../../entity/table1';
import { Table2 } from '../../entity/table2';
import { Table2 } from '../../entity/table3';
const dbpath = require('os').homedir() + '/.myapp/db.sqlite'
createConnection({
type: 'sqlite',
database: dbpath,
entities: [
Table1,
Table2,
Table3
]
}).then(connection => {
console.log('connected to sql from typeorm')
}).catch(error => console.log(error));
This works just fine in dev, but in prod, it fails to find the tables.
QueryFailedError: SQLITE_ERROR: no such table: e
I suspect its because in prod, webpack runs UglifyJsPlugin. Doe’s anyone know how to fix this?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Electron application SQLITE package has not been found ...
SQLite3 is a native Node.js module so it can't be used directly with Electron without rebuilding it to target Electron.The electron-builder ...
Read more >How to Use TypeORM with Webpack - Atomic Spin
This happens because TypeORM is running inside the Webpack build and trying to require the un-compiled code that is specified in the entities...
Read more >typeorm error driver not connected - You.com | The AI Search ...
I suspect its because in prod, webpack runs UglifyJsPlugin. Doe's anyone know how to fix this? Open side panel.
Read more >sql.js - Bountysource
After I import the sql.js on my electron-react project, I got following ... result.request.replace(/typeorm/, "typeorm/browser"); }), new Webpack.
Read more >[Solved]-Webpack - SyntaxError: Unexpected token {-node.js
Coding example for the question Webpack - SyntaxError: Unexpected token {-node.js.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Quick fix:
you need to put table name into entity like this:
@Entity("table1") export class Table1 {