New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@babel/polyfill loaded multiple times #2955

Closed
klaemo opened this Issue Dec 14, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@klaemo
Copy link

klaemo commented Dec 14, 2018

Environment

Knex version: 0.16.2
Database + version: Postgres 9 + CockroachDB
OS: macOS + linux

Bug

@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning.

This might happen because we require knex in two different files as we use two different databases. If knex is only to be required once per server/app (which would be weird), I guess that should be mentioned somewhere? Did I miss that?

I think it's not a good practice to include @babel/polyfill in a library. Like in the browser libraries shouldn't mess with the global scope. From the @babel/polyfill documentation:

This will emulate a full ES2015+ environment (no < Stage 4 proposals) and is intended to be used in an application rather than a library/tool.

@kibertoad

This comment has been minimized.

Copy link
Collaborator

kibertoad commented Dec 19, 2018

0.16.3 is out with a fix for this.

@klaemo

This comment has been minimized.

Copy link

klaemo commented Dec 23, 2018

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment