hiddentao / squel

:office: SQL query string builder for Javascript
https://hiddentao.github.io/squel
MIT License
1.56k stars 231 forks source link

squel.select().from is undefined after minimizing #372

Open jonathanpipe opened 5 years ago

jonathanpipe commented 5 years ago

Only after minimizing, when I try to do squel.select().from(...) I get an error that squel.select().from is undefined. When not minimized, the code works fine. Has anyone successfully minimized the code using webpack 4?

RickyRoller commented 5 years ago

I'm seeing the same issue. Has anyone been able to find a way around it? It looks like the squel.select() doesn't return the squel object after it's been minified, so it can't be chained.

RickyRoller commented 5 years ago

I added squel to the global variables in my build and stopped importing it throughout the app. Unfortunate, but now it works. My use case is with an angular-cli build (which is using webpack 4) but there is a scripts property in the build that allows you to globally load the script (same as adding the script tag to index.html)

jonathanpipe commented 5 years ago

I ended up excluding it from webpack build and added it as an external:

In webpack config

    config.externals = {
        squel: 'squel'
    };

In html

<script type="text/javascript" src="/assets/externals/squel.min.js"></script>
FrancescoBorzi commented 5 years ago

Confirmed, same problem here. @hiddentao can you please have a look at this?

FrancescoBorzi commented 5 years ago

@RickyRoller thanks a lot for the tip, I'm also using Angular and solved this way: https://github.com/azerothcore/Keira3/commit/98f191eb59cf9c853dd8a54a845a029c7a4ddef8

However, it's really a pity to have such a bug :(

taibui-rogue commented 5 years ago

has any one found a solution for React JS?