superwf / vuex-cache

cache vuex action when dispatch
MIT License
510 stars 32 forks source link

Unexpected keyword 'const' - Babel Error? #12

Closed hvaughan3 closed 6 years ago

hvaughan3 commented 6 years ago

Receiving the following error on an iOS 9.3.2 device when using this plugin:

Unexpected keyword 'const'. Const declarations are not supported in strict mode.

I assume it has to do with babel 7 configuration (as old Safari versions do not natively handle const). So would this be something we need to handle in then config of our project or is this something wrong in the plugin code? If so, any tips to help me accomplish that? I am lost when it comes to webpack and babel configs. Thanks!

VitorLuizC commented 6 years ago

You can fix using same suggestions as https://github.com/superwf/vuex-cache/issues/8#issuecomment-423168400.

VitorLuizC commented 6 years ago

@superwf maybe bundle down just UMD seems a huge problem, so I'll make another PR bundling down ESM and UMD modules

superwf commented 6 years ago

@VitorLuizC maybe I should use the umd format for main file for this package to make it more compatible?

hvaughan3 commented 6 years ago

@VitorLuizC Think I understand now. Appreciate your help.

VitorLuizC commented 6 years ago

@superwf I think we have to bundle down ESM, but keep it as ESM.

I've been doing this for a while in my libraries using https://github.com/egoist/bili. It bundle to multiple module outputs and is very simple to setup and use.

Ex. https://github.com/VitorLuizC/vue-uuid