hapipal / confidence

Dynamic, declarative configurations
Other
264 stars 44 forks source link

using in webpack with uglifyjs breaks uglification #51

Closed kellyrmilligan closed 8 years ago

kellyrmilligan commented 8 years ago

any ideas on this? I like the filtering functionality and was wanting to use it with webpack.

patrickkettner commented 8 years ago

In what way does it break it?

On Apr 19, 2016, at 12:50 PM, Kelly notifications@github.com wrote:

any ideas on this? I like the filtering functionality and was wanting to use it with webpack.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

kellyrmilligan commented 8 years ago

well, it does't break the process, but the resulting file is not minified at all. when I take out confidence, its fine. so the app still works,but somehow breaks uglify.

kellyrmilligan commented 8 years ago

I've created a working port of the store that doesn't use hoek or boom, and uses lodash instead for the boom equivalent functions. works like a charm. I feel like client side apps can use this sort of module ,but don't need all of what comes with this currently. I may post it as a module and link back to confidence, is there a proper way to do that?

kellyrmilligan commented 8 years ago

and it solved the minification issue.

patrickkettner commented 8 years ago

If you could post a demo, it would be super helpful.

On Apr 19, 2016, at 1:21 PM, Kelly notifications@github.com wrote:

well, it does't break the process, but the resulting file is not minified at all. when I take out confidence, its fine. so the app still works,but somehow breaks uglify.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

kellyrmilligan commented 8 years ago

sure, demo for which one? how it breaks uglify, or the port? and I realized earlier I meant hoek equivalent functions

patrickkettner commented 8 years ago

The breakage

On Apr 19, 2016, at 6:59 PM, Kelly notifications@github.com wrote:

sure, demo for which one? how it breaks uglify, or the port?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

patrickkettner commented 8 years ago

ping @kellyrmilligan

kellyrmilligan commented 8 years ago

my bad. Closing for now as I won't have time to do demo of it.

joshlasdin commented 8 years ago

@patrickkettner having this issue as well, here's the error it's outputting in my gulp task:

[17:51:42] { [Error: scripts.js from UglifyJs
Unexpected token: operator (>) [./~/confidence/lib/store.js:46,0]]
  message: 'scripts.js from UglifyJs\nUnexpected token: operator (>) [./~/confidence/lib/store.js:46,0]',
  showStack: false,
  showProperties: true,
  plugin: 'webpack-stream',
  __safety: { toString: [Function: bound ] } }
joshlasdin commented 8 years ago

Though not very helpful, backing off to previous version from NPM (1.4.2) seems to be a workaround.

Marsup commented 8 years ago

UglifyJs is kind of abandoned, it won't understand ES6, you have to transpile it first.

joshlasdin commented 8 years ago

@Marsup right, which I am (transpiling).

Marsup commented 8 years ago

In the correct order ?

joshlasdin commented 8 years ago

I believe so -- I'm using webpack, which I'm pretty sure runs code through the loaders first (babel/transpiling), then passes on to plugins (uglify/minifying).

samkelleher commented 8 years ago

Are you able to share your port @kellyrmilligan - even if it is rough around the edges?

kellyrmilligan commented 8 years ago

Yes it's on npm as conf-store

kellyrmilligan commented 8 years ago

https://www.npmjs.com/package/conf-store

kellyrmilligan commented 8 years ago

From before I thought maybe it had to do with some of the crypto stuff included with condfidence

samkelleher commented 8 years ago

@kellyrmilligan Nice one cheers! 🎉 Saved me from rolling my own. I like the confidence API format and filter mechanism, but does appear to be incompatible with Webpack Uglify for the time being, and imports a bunch of server-only dependencies.

For reference, I found that the dependency 'hoek' exports a non-es5 'let' statement. Since babel is configured to ignore node_modules by default, it gets through to uglify where it then fails. I could specifically make an allowance to force babel to transpile it, but this is when I realised how much confidence is pulling into my app simply to allow me for convenient config manager. Opting to use something like confidence to setup the config and inject it at build time, rather than running it at run time seems like a longer + cleaner objective.

kellyrmilligan commented 8 years ago

For me it didn't fail, it just didn't come out uglified. I use my port with its cli wrapper to do just what you describe. It filters it and produces a Json file that I then import in my app with Json loader