Skip to content

Conversation

@95ulisse
Copy link

When the primary output depends on some of the modules that are gonna be bundled in an external file, dependencies get messed out and the bundles are not constructed as expected.

Example Gulpfile:

var gulp = require('gulp'),
    rjs = require('gulp-requirejs-bundler');

gulp.task('default', function () {

    var optimizerConfiguration = {
        name: 'main',
        baseUrl: './src',
        out: 'main.js',
        bundles: {
            'first-bundle': [
                'first-bundle-module1',
                'first-bundle-module2'
            ],
            'second-bundle': [
                'second-bundle-module1',
                'second-bundle-module2'
            ]
        }
    };

    return rjs(optimizerConfiguration)
        .pipe(gulp.dest('./out'));
});

All the modules have no dependencies, except for main which depends on all the other modules.

The output of the above configuration is:

  • main.js containing all the modules and the configuration
  • first-bundle.js which is empty
  • second-bundle.js which is empty

With this patch, the output is as expected:

  • main.js containing main-only-module, main and the configuration
  • first-bundle.js containing first-bundle-module1 and first-bundle-module2
  • second-bundle.js containing second-bundle-module1 and second-bundle-module2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant