jonathanpmartins / v-money3

Vue3 currency input/directive mask
MIT License
103 stars 27 forks source link

Error: Big integer literals are not available in the configured target environment #66

Closed fylzero closed 2 years ago

fylzero commented 2 years ago

When compiling my front end application with Vite I'm running into the following error:

✘ [ERROR] Big integer literals are not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")

    node_modules/v-money3/dist/v-money3.es.js:137:34:
      137 │     __publicField(this, "number", 0n);
          ╵                                   ~~

✘ [ERROR] Big integer literals are not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")

    node_modules/v-money3/dist/v-money3.es.js:223:41:
      223 │       thatNum = thatNumber.getNumber() * 10n ** BigInt(diff);
          ╵                                          ~~~

✘ [ERROR] Big integer literals are not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")

    node_modules/v-money3/dist/v-money3.es.js:225:35:
      225 │       thisNum = this.getNumber() * 10n ** BigInt(diff * -1);
          ╵                                    ~~~
fylzero commented 2 years ago

Found a solution here: https://github.com/vitejs/vite/issues/6985#issuecomment-1044375490

jonathanpmartins commented 2 years ago

You don't need to use esnext, es2020 should be fine!

Can I use bigInt? https://caniuse.com/bigint

image

https://caniuse.com/?search=es2020