Comments (4)
This is the code I use to get uglify-js
to work for me:
var bundle = browserify({
entry: "browser_entry.js",
filter: function(code) {
if (cmdline.options.uglify) {
var uglifyjs = require("uglify-js"),
parser = uglifyjs.parser,
uglify = uglifyjs.uglify;
var ast = parser.parse(code);
ast = uglify.ast_mangle(ast);
ast = uglify.ast_squeeze(ast);
return uglify.gen_code(ast);
}
else {
return code;
}
},
});
from browserify.
Thks, I ended up using something similar too, I will dig into the source to check what I was doing wrong
from browserify.
You should be able to just:
browserify({
filter : env === 'production' ? require('uglify-js') : String
/* ... */
})
from browserify.
For Uglify2 I had to do:
bundle.register('post', function (body) {
return uglify.minify(body, {
'fromString': true
}).code;
});
from browserify.
Related Issues (20)
- Browserfy does not working with compiled libraries HOT 2
- SyntaxError: Unexpected token (53:4) while parsing HOT 1
- [spam]
- Unexpected character '#' HOT 1
- visitor[(override || node.type)] is not a function
- Dump offending code when acorn complains about syntax error HOT 4
- querystring API considered legacy by npm HOT 1
- require fs-js in browser does not work after creating and including Bundle HOT 1
- TypeError: this.buffers[pos.buf].get is not a function
- ااااا HOT 1
- When using `pnpm`, a module that uses `Buffer.isBuffer` fails to bundle HOT 2
- Calling bundle file from react gives Syntax error: react_app_testing/src/HashBundle.js: Unexpected character '�' (1:0) HOT 7
- Archive this repository HOT 7
- Doc: Typescript support
- Hey Some one please help :- browserify error with webtorrent HOT 3
- Browserify + common-shakeify + Chart.js = infinite stack trace HOT 2
- ERROR in ./node_modules/ ... in ReactJs HOT 2
- Getting error `require is not defined` HOT 4
- Stop browserify from evaluating dynamic imports ( import() ) and crashing? HOT 3
- Where do I put flags in config?
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 browserify.