whitlockjc / json-refs

Various utilities for JSON Pointers (http://tools.ietf.org/html/rfc6901) and JSON References (http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

json-refs causes Webpack / Uglify to throw an error

spacedarcy opened this issue · comments

commented

Using json-refs v3.0.0

When trying to import json-refs, Webpack throws the following error:

ERROR in js/build.js from UglifyJs Unexpected token: name (e) [js/build.js:14985,8]

Here's the npm log output:

npm verb lifecycle proj@0.3.0~dist: unsafe-perm in lifecycle true npm verb lifecycle proj@0.3.0~dist: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/opt/project/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin npm verb lifecycle proj@0.3.0~dist: CWD: /opt/project npm info lifecycle proj@0.3.0~dist: Failed to exec dist script npm verb stack Error: proj@0.3.0 dist: webpack -p --display-error-detailsnpm verb stack Exit status 2 npm verb stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16) npm verb stack at emitTwo (events.js:106:13) npm verb stack at EventEmitter.emit (events.js:191:7) npm verb stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14) npm verb stack at emitTwo (events.js:106:13) npm verb stack at ChildProcess.emit (events.js:191:7) npm verb stack at maybeClose (internal/child_process.js:891:16) npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) npm verb pkgid proj@0.3.0 npm verb cwd /opt/project npm ERR! Linux 4.9.41-moby npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run-script" "dist" "--verbose" npm ERR! node v6.11.2 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! proj@0.3.0 dist:webpack -p --display-error-details npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the proj@0.3.0 dist script 'webpack -p --display-error-details'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the proj package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! webpack -p --display-error-details npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs proj npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls proj npm ERR! There is likely additional logging output above. npm verb exit [ 1, true ]

The unexpected token is on the highlighted line, I think it might be the let?

screen shot 2017-08-25 at 3 17 10 pm

Both webpack -pand webpack --optimize-minimize produce this error. When run without these flags the plugin works perfectly.

This is not related to json-refs and is a common webpack configuration issue. In fact, the code above is not even json-refs. I did some googling for "ERROR in js/build.js from UglifyJs Unexpected token: name" and I found a ton of hits, including this: webpack/webpack#2972