-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only common bundle created #29
Comments
Can you confirm the version of You can also test within this repository:
This produces the three files with the expected outputs. |
I have now got this working from the command line. Browserify was installed globally at 5.9.1 and after updating to 5.10.1 I got the three files as expected. I still can't get it to work as expected when using Gulp though. I found someone that looks like they're having the same issue: http://stackoverflow.com/questions/25280457/browserify-and-factor-bundle-producing-only-one-file My gulp task is very similar to this one and I'm having the same problem of just a common.js file being produced. Any help would be very appreciated! Thanks |
@jrp90 in your example, does page1 or page2 require the other page? |
No, both require 2 modules I want to be in the common js file and each one requires another page specific module I want to be in its own file. The strange thing is it works as expected on my files if I use the command line but not when using my Gulp task. Works: browserify ./app/assets/js/main.js ./app/assets/js/search.js -p [ factor-bundle -o ./public/js/main.js -o ./public/js/search.js ] -o ./public/js/common.js Doesn't work: var gulp = require('gulp');
var browserify = require('browserify');
var sourceStream = require('vinyl-source-stream');
var factor = require('factor-bundle');
gulp.task('browserify', function(){
return browserify({
entries: ['./app/assets/js/main.js', './app/assets/js/search.js'],
})
.plugin(factor, {
o: ['./public/js/main.js', './public/js/search.js']
})
.bundle()
.pipe(sourceStream('common.js'))
.pipe(gulp.dest('./public/js/'));
}); |
I seem to be having the same issue. It also works find from the command line, but not from gulp. |
I have a workaround for now if you need one - just use the gulp-shell plugin to run the task... var gulp = require('gulp')
var shell = require('gulp-shell')
gulp.task('browserify-shell', shell.task([
'browserify ./app/assets/js/main.js ./app/assets/js/search.js -p [ factor-bundle -o ./public/js/main.js -o ./public/js/search.js ] -o ./public/js/common.js'
])); |
I have the same issue as well |
@jrp90 Ya, I ended up using the same workaround. Not ideal, but what factor-bundle does is fantastic enough to make it worth while. |
Bummer this isn't worked out as a plugin as its not deployable via heroku now unless a custom build pack is created specific to the project. Any ideas on when this might be fixed? |
Same problem here. |
JFYI I had the same issue. The workaround I found is usage of full paths + duplicate browserify({
entries: ['c:/project/auth-logon/index.js', 'c:/project/views/model-create/index.js']
})
.plugin(factor, {
entries: ['c:/project/auth-logon/index.js', 'c:/project/views/model-create/index.js'],
o: ['c:/project/build/auth-logon.js', 'c:/project/build/model-create.js']
})
.bundle()
.pipe(source('common.js'))
.pipe(gulp.dest(buildPath)); It appers that second My factor-bundle is 2.2.1 and browserify 5.11.2. |
@mikalai-silivonik Nice ! Your workaround works for me and is a lot better than the gulp-shell solution. |
Possibly the fix in factor-bundle core would be to |
I can also confirm that this solution worked for me. @substack Ya, my solution was mapping |
Awesome! This fixed my problem, too... especially @defrex 's suggestion to path.resolve the entries and output,
Now, on to adding bromote for the runtime-only scripts... |
I'll patch this up, and look into why we aren't getting entries from browserify properly. |
Don't know if I am doing something wrong or else, but I have the same problem even with a command line. So: I have explicitly installed browserify@5.10.1 and factor-bundle@2.1.1, both globally (-g flag). console.log("X!"); y.js console.log("Y!"); xy.js console.log("XY!"); a.js require('./x.js');
require('./xy.js'); and require('./y.js');
require('./xy.js'); Then I run in command line
And get only the "bcommon.js" file with x,y and xy all bundled into it. |
@DenMesh I just tried your test case with
A fix for this I believe was included with 2.2.4, added by @substack. |
Not sure whether this is an issue or just something I'm doing wrong or misunderstanding.
I'm trying to use factor-bundle to split my javascript into bundles for common and page-specific javascript but I can't even get the example given in the readme to work.
When I create the files x.js, y.js etc and run factor-bundle as a browserify plugin:
I just get the following output in bundle/common.js as the only file. I was expecting only the common modules to be present here and additional x.js and y.js files?
Browserify version 5.9.3
Factor-bundle version 2.1.1
The text was updated successfully, but these errors were encountered: