bundle has no method 'transform'
thomas@workstation:holstee-browserify$ DEBUG=* browserify main.js > bundle.js
/Users/thomas/Desktop/holstee-browserify/node_modules/minifyify/lib/index.js:26
bundle.transform({global: true}, minifier.transformer);
^
TypeError: Object /Users/thomas/Desktop/holstee-browserify/main.js has no method 'transform'
at plugin (/Users/thomas/Desktop/holstee-browserify/node_modules/minifyify/lib/index.js:26:10)
at nr (/Users/thomas/.nvm/v0.10.32/lib/node_modules/browserify/node_modules/module-deps/index.js:281:23)
at /Users/thomas/.nvm/v0.10.32/lib/node_modules/browserify/node_modules/resolve/lib/async.js:44:21
at ondir (/Users/thomas/.nvm/v0.10.32/lib/node_modules/browserify/node_modules/resolve/lib/async.js:187:31)
at /Users/thomas/.nvm/v0.10.32/lib/node_modules/browserify/node_modules/resolve/lib/async.js:159:43
at onex (/Users/thomas/.nvm/v0.10.32/lib/node_modules/browserify/node_modules/resolve/lib/async.js:93:22)
at /Users/thomas/.nvm/v0.10.32/lib/node_modules/browserify/node_modules/resolve/lib/async.js:24:18
at Object.oncomplete (fs.js:107:15)
what version of browserify?
You should use .plugin, not .transform :)
@ben-ng 9.0.3 @StevenLangbroek I should be using plugin? I just added minifyify to my package.json under transforms, is that not right?
@reggi, i just installed it as part of my dev dependencies, then use it as a plugin. Shouldn't need to load it under transforms, no.
@reggi I got the same if I used the minifyify as a transform option like browserify app.js -t minifyify So instead of trying to use it as a transform ( because I just replaced the uglifyify transform as first try ) but as a plugin it should be used like this: browserify app.js -p [ minifyify --output bundle.map.json ] > bundle.min.js Just as shown under the Usage section at the https://www.npmjs.com/package/minifyify I am sure you already figured this out. But might be helpful for others.
Thanks @aronbirkir! Very helpful!
If someone can think of a way to detect when the plugin is incorrectly used as a transform, we can display a more useful error before browserify poops out
I am using it as a plugin (with grunt) and getting Cannot find module '[object Object]' from '...' Use --force to continue.. does my setup look correct? Browserify runs fine without the plugin..
browserify : {
options: {
transform: ['debowerify'],
plugin: [
'minifyify', [{
map: '<%= config.app %>/scripts/main.map.json'
}]
]
// debug: true
},
server : {
files : { '<%= config.app %>/scripts/main.js' : ['<%= config.app %>/scripts/modules/index.js'] }
},
dist : {
files : { '<%= config.dist %>/scripts/main.js' : ['<%= config.app %>/scripts/modules/index.js'] }
}
},
I don't use grunt and haven't seen this error before. Can you post the full stack trace?
I'm fairly certain I'm including it in my gruntfile correctly..
Warning: Cannot find module '[object Object]' from 'mysite' Use --force to
continue.
Error: Cannot find module '[object Object]' from 'mysite'
at Function.module.exports as sync
at Browserify.plugin
(mysite/node_modules/grunt-browserify/node_modules/browserify/index.js:351:29)
at mysite/node_modules/grunt-browserify/lib/runner.js:116:13
at arrayEach
(mysite/node_modules/grunt-browserify/node_modules/lodash/index.js:1289:13)
at Function.
On Mon, Jul 27, 2015 at 15:56 Ben [email protected] wrote:
I don't use grunt and haven't seen this error before. Can you post the full stack trace?
— Reply to this email directly or view it on GitHub https://github.com/ben-ng/minifyify/issues/82#issuecomment-125325865.
@thedamon I'm fairly certain that the browserify grunt plugin requires you to pass a list of tuples to plugin, i.e.
plugin: [
['minifyify', [{
...opts...
}]]
]
instead of
plugin: [
'minifyify', [{
...opts...
}]
]