Open JHKennedy4 opened 10 years ago
@shuhei can we drop support for shim and allow using via transforms ?
@deepak1556 Yeah, it would be nice to deprecate it first showing warning and drop it later.
Does the browserify-shim transform currently work? Is there an example how to configure it?
@jgrowl there is an example in #48 by @shuhei , will doc in readme soon.
@jgrowl This plugin does nothing to transforms. See browserify-shim's README for examples.
@shuhei @deepak1556 Ahh, thanks. I was getting thrown off because when I added "browserify-shim" to my transforms in my gulpfile I was getting
Error: browserify-shim needs to be passed a proper browserify instance as the first argument.
If I add the configuration purely in the package.json file, all seems good.
Just to make it clear for future reference:
Thanks! On Feb 13, 2014 9:14 PM, "gaastonsr" notifications@github.com wrote:
Just to make it clear for future reference:
- Install browserify-shim (npm install --save-dev browserify-shim)
- Put all config in package.json. See browserify-shim's READMEhttps://github.com/thlorenz/browserify-shimfor examples.
- Register the transform with gulp-browserify (transform: ['browserify-shim'])
Reply to this email directly or view it on GitHubhttps://github.com/deepak1556/gulp-browserify/issues/53#issuecomment-35049389 .
Hi, every body!
I'm tying to use browserify-shim with karma and encounter such error: Error: browserify-shim needs to be passed a proper browserify instance as the first argument.
The same thing I've got when use broserify from command line. Here is my package.json part:
"browserify": {
"transform": [ "browserify-shim" ]
},
"browser": {
"jquery" : "./client/requires/jquery/js/jquery.js",
"bootstrap" : "./client/requires/bootstrap/bootstrap.js"
},
"browserify-shim": {
"jquery" : "$",
"bootstrap" : {"exports": null, "depends": [ "jquery" ]
}
my file mainSpec.js
to be browserifed looks this way:
...
var someModule = require('path/to/module');
require('bootstrap');
...
then in command line
$ broserify mainSpec.js -o bundleSpec.js
I use browserify v 2.36.1 and browserify-shim v 2.0.10
Could some body, please, tell me what I do wrong? And how to solve it?
@mwmaleks use browserify-shim v3
Thank you! Now it works!
I still encounter issues with browserify-shim
, but only when using it with gulp-browserify
.
My package.json
{
"browserify": {
"transform": [ "browserify-shim" ]
},
"browserify-shim": {
"jquery": "global:jQuery"
},
"devDependencies": {
"browserify": "^4.2.0",
"browserify-shim": "^3.6.0",
"gulp": "^3.8.5",
"gulp-browserify": "^0.5.0"
}
}
(I tried it with and without the browserify
-part)
My gulpfile.js
var gulp = require("gulp");
var browserify = require("gulp-browserify");
gulp.task("default",
function ()
{
return gulp.src("in/*.js")
.pipe(browserify({
transform: ['browserify-shim']
}))
.pipe(gulp.dest("out/"));
}
);
The CLI works just fine:
~/Desktop/gulp $ ./node_modules/.bin/browserify in/*.js
(function e(t,n,r){......
Gulp doesn't work however:
~/Desktop/gulp $ gulp
[19:47:20] Using gulpfile ~/Desktop/gulp/gulpfile.js
[19:47:20] Starting 'default'...
.../Desktop/gulp/node_modules/gulp-browserify/node_modules/browserify-shim/index.js:16
throw new Error('browserify-shim needs to be passed a proper browserify in
^
Error: browserify-shim needs to be passed a proper browserify instance as the first argument.
you passed:'.../Desktop/gulp/in/fake_7b97708d.js'
Exact versions:
~/Desktop/gulp $ npm ls --depth 0
@ ~/Desktop/gulp
├── browserify@4.2.0
├── browserify-shim@3.6.0
├── gulp@3.8.5
└── gulp-browserify@0.5.0
@deepak1556 any idea?
I ran into the same issue as @apfelbox today.
Allows support for shimming libraries loaded via cdn, would also allow you to reference their current docs.