Typeorm: Troubles with UglifyJS

Created on 17 Feb 2017  路  3Comments  路  Source: typeorm/typeorm

I use webpack and babel. I pass imported models to the connectionConfig. When I build the app for production with UglifyJsPlugin, an error occurs: ER_NO_SUCH_TABLE: Table 'posts-app.e' doesn't exist. How to avoid it without disabling the plugin? I found only one way: pass such options: mangle: { except: ['Post','User'] }

question

Most helpful comment

You have such error because table names are generated from class names, e.g. Post and User, but when you minify your code uglifier made your names p and e now. You have several choices: set explicit names for your tables, e.g. @Entity("post") and @Entity("user") or enable mangle (no need to specify entities, just mangle them all) or simply don't use uglify because its really pointless to use it and webpack on the backend.

All 3 comments

You have such error because table names are generated from class names, e.g. Post and User, but when you minify your code uglifier made your names p and e now. You have several choices: set explicit names for your tables, e.g. @Entity("post") and @Entity("user") or enable mangle (no need to specify entities, just mangle them all) or simply don't use uglify because its really pointless to use it and webpack on the backend.

I guess I've answered your question and now this issue can be closed.

@pleerock sure. Much thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

laukaichung picture laukaichung  路  3Comments

niveo picture niveo  路  3Comments

juanjalvarez picture juanjalvarez  路  3Comments

NoNameProvided picture NoNameProvided  路  3Comments

brunosiqueira picture brunosiqueira  路  3Comments