Comments (12)
I don't have a minimal reproduction yet, but using [email protected]
my production use case results in:
`_flags` is not a supported option
from uglifyify.
Hey! I am looking into it for you.
Out of curiosity does something like this uglifyify -c dead_code
still return an error for you?
from uglifyify.
Is this what you mean?
$ cat pr.js
"use strict";
module.exports = "nope";
$ ./node_modules/.bin/browserify -g [ uglifyify -c ] pr.js
TypeError: Cannot read property 'replace' of undefined while parsing file: pr.js
at Stream.ready (node_modules/uglifyify/index.js:78:24)
at Stream.<anonymous> (node_modules/uglifyify/index.js:100:12)
at _end (node_modules/through/index.js:65:9)
at Stream.stream.end (node_modules/through/index.js:74:5)
at DestroyableTransform.onend (node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:499:10)
at Object.onceWrapper (events.js:314:30)
at emitNone (events.js:110:20)
at DestroyableTransform.emit (events.js:207:7)
at endReadableNT (node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:920:12)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
from uglifyify.
For completeness, it succeeds on 3.0.4:
$ npm install uglifyify --no-save
+ [email protected]
removed 1 package and updated 1 package in 3.265s
$ ./node_modules/.bin/browserify -g [ uglifyify -c ] pr.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";module.exports="nope";
},{}]},{},[1]);
from uglifyify.
No, not quite. I wanted to see if passing an option to--compress
might help, since the new uglify comes with a bunch of them you could work with.
But let me try to just replicate it just as you have it in the latter two examples and see where I get on.
from uglifyify.
Okay, cool, I was able to replicate and it's having issues on extend
; interestingly only with command-line options. I use it outside of the command-line context, so never noticed this issue with the original pr. Give me a bit, and I should have a fix for you.
from uglifyify.
I'm seeing the same issue but with 3.0.4
I am running it programmatically as opposed to the CLI
from uglifyify.
the TypeError is masking the real error the return value from ujs.minify()
(see here), is always an object BUT it may contain an error
property, in which case it is likely that it does not have a code
property (which the code is blindly assuming it it).
The underlying error (at least those I have had) alwasy relate to invalid options (for uglify) - this is because the uglify-es
modules is being used (which breaks API compatibility with uglify@v2).
I think this modules should do suitable checking of the return value of ujs.minify()
(does min.code
exist, does min.error
exist, etc ... and then display, throw the returned error data), also alway pass a copy/clone of the opts
object to ujs.minify()
(really the given opts
should be cloned and then the clone manipulated)
from uglifyify.
I hacked the following PR, which tackles the swallowed minify()
errors & problems related to not-cloning options before manipulating and/or passing them on : PR-69
from uglifyify.
Ok, so uglify no longer supports shortened CLI in there JS api, but hopefully that is fixed for you in 📦 4.0.2
.
I still want to address creating a new opts object, and that should be fixed by @iamjochem #69.
from uglifyify.
from uglifyify.
I'm also affected by `_flags` is not a supported option
from uglifyify.
Related Issues (20)
- Optional chaining support
- Update terser up to 4.8.1 HOT 1
- update to a maintained `through`?
- command line usage does not work HOT 2
- (v4) `ignore` is not a supported option HOT 2
- (v4) How to use "extensions" (-x, --exts) with node HOT 2
- Add CHANGELOG.md HOT 4
- Add better tests HOT 2
- Uglifyify fails when calling uglify HOT 3
- Missing command line entry
- --ignore flag being ignored in Jenkins environment HOT 2
- New dependency name: uglify-es => terser #1 HOT 2
- Fatal error: `ignore` is not a supported option while parsing file: HOT 2
- Update to [email protected]
- Inlined sourcemaps
- Global flag is ignored
- beautify does not work; should be an output option
- update package extend to >2.0.2 to remove package vurnerability HOT 1
- Wrong CLI option for Source Maps in README.md
- SyntaxError: 'return' outside of function while parsing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uglifyify.