MikeKovarik / gulp-better-rollup

📦 Better Gulp plugin for Rollup ES6 module bundler
MIT License
49 stars 16 forks source link

Single configuration does not appear to be working? #9

Closed objectkit closed 7 years ago

objectkit commented 7 years ago

Delighted to have found gulp-better-rollup... a real relief. Anyhow, I particularly like the promise of simplifying configuration into one object, but I've run into a problem.

This two step config works:

gulp.task("build", function() {
  return gulp.src(settings.build.entryFile).pipe(rollup({
    plugins: [
      rootImport({
        root: settings.build.rootDir,
        extensions: ".js",
        useEntry: "prepend"
      })
    ]
  }, {
    banner: fs.readFileSync(settings.build.libFile),
    format: 'es',
    exports: "named",
    useStrict: false
  })).pipe(gulp.dest(settings.build.buildDir));
});

But this single config does not:

gulp.task("build", function() {
  return gulp.src(settings.build.entryFile).pipe(rollup({
    plugins: [
      rootImport({
        root: settings.build.rootDir,
        extensions: ".js",
        useEntry: "prepend"
      })
    ],
    banner: fs.readFileSync(settings.build.libFile),
    format: 'es',
    exports: "named",
    useStrict: false
  })).pipe(gulp.dest(settings.build.buildDir));
});

For reference, here is the CoffeeScript implementation of the build task that I am using. Deleting the comma beside the #bundle config comment outputs the single config; leaving it in outputs the dual config.

gulp.task "build", ->
    gulp.src settings.build.entryFile
        .pipe rollup
            # rollup config
            plugins: [
                rootImport
                    root: settings.build.rootDir
                    extensions: ".js"
                    useEntry: "prepend"
            ]
        ,   # bundle config
            banner: fs.readFileSync settings.build.libFile
            format: 'es'
            exports: "named"
            useStrict: no
        .pipe gulp.dest settings.build.buildDir

It seems to me that the scripts are correct. The issue is that the rootImport plugin does not seem to be used when better-rollup is provided a single configuration object, so I'm wondering if the single configuration object is being read correctly by gulp-better-plugin?

objectkit commented 7 years ago

Great plugin, but found alternative. Closing. Thanks.

MikeKovarik commented 7 years ago

I'm sorry, but I'm in middle of finishing my bachelor's thesis and studying for graduation and i cannot dedicate any time to this project for now

objectkit commented 7 years ago

Totally understandable. Not a problem. Carpe diem!