MichalZalecki / storage-factory

Because using localStorage directly is a bad idea
https://www.npmjs.com/package/storage-factory
63 stars 5 forks source link

build error "Unexpected token: name (inMemoryStorage)" #5

Closed tjmcewan closed 6 years ago

tjmcewan commented 6 years ago

Howdy, as soon as I import the storage file into my project, my build fails with the following:

ERROR in js/client.js from UglifyJs Unexpected token: name (inMemoryStorage) [./node_modules/storage-factory/lib/index.js:4,0][js/client.js:145327,8]

Any ideas?

MichalZalecki commented 6 years ago

@tjmcewan Thanks for your comment. What's your build environment? Old uglify doesn't support ES2015 features.

tjmcewan commented 6 years ago

Oh right, I see; it's the let. If I specifically add your module to my build pipeline's inclusions it works. Is there a convention around who should be doing the transpiling? Would you be able to publish the transpiled version? Thanks.

MichalZalecki commented 6 years ago

Is there a convention around who should be doing the transpiling?

I think you explicitly excluded all node_modules from processing with babel. I don't know what do you use but this is how it works in many webpack "starters". The problem is that it forces building to older and older versions of JavaScript and not up-to-date tooling is preventing the ecosystem/library authors from switching.

Putting my whining aside... I'll prepare a patch version without let, publish it and probably publish also ES6 module version.

tjmcewan commented 6 years ago

Thanks mate, appreciate it. Sorry I didn't get the context; I'm new to front-end dev.

I didn't setup this project, but I can't find anywhere that node_modules is excluded, just looks like it's not included. The only 3rd-party package that is included is jsts.