gulpfile.js
function(name, path) {
  path = path || '';
  return gulp.src(`${buildFolder}${path}/**/*.js`)
  // transform the files here.
    .pipe(rollup({

      // Bundle's entry point
      // See "input" in https://rollupjs.org/#core-functionality
      input: `${buildFolder}${path}/index.js`,

      // Allow mixing of hypothetical and actual files. "Actual" files can be files
      // accessed by Rollup or produced by plugins further down the chain.
      // This prevents errors like: 'path/file' does not exist in the hypothetical file system
      // when subdirectories are used in the `src` directory.
      allowRealFiles: true,

      // A list of IDs of modules that should remain external to the bundle
      // See "external" in https://rollupjs.org/#core-functionality
      external: [
        '@angular/core',
        '@angular/common'
      ],

      output: {
        // Format of generated bundle
        // See "format" in https://rollupjs.org/#core-functionality
        format: 'es'
      }
    }))
    .pipe(gulp.dest(`${distFolder}${path}`));
}
function(name, path) {
  path = path || '';
  return gulp.src(`${buildFolder}${path}/**/*.js`)
  // transform the files here.
    .pipe(rollup({

      // Bundle's entry point
      // See "input" in https://rollupjs.org/#core-functionality
      input: `${buildFolder}${path}/index.js`,

      // Allow mixing of hypothetical and actual files. "Actual" files can be files
      // accessed by Rollup or produced by plugins further down the chain.
      // This prevents errors like: 'path/file' does not exist in the hypothetical file system
      // when subdirectories are used in the `src` directory.
      allowRealFiles: true,

      // A list of IDs of modules that should remain external to the bundle
      // See "external" in https://rollupjs.org/#core-functionality
      external: [
        '@angular/core',
        '@angular/common'
      ],

      output: {
        // Format of generated bundle
        // See "format" in https://rollupjs.org/#core-functionality
        format: 'es'
      }
    }))
    .pipe(gulp.dest(`${distFolder}${path}`));
}
function ( name , path ) { path = path || '' ; return gulp . src ( ` ${ buildFolder } ${ path } ` ) // transform the files here. . pipe ( rollup ( { // Bundle's entry point // See "input" in https://rollupjs.org/#core-functionality input : ` ${ buildFolder } ${ path } ` , // Allow mixing of hypothetical and actual files. "Actual" files can be files // accessed by Rollup or produced by plugins further down the chain. // This prevents errors like: 'path/file' does not exist in the hypothetical file system // when subdirectories are used in the `src` directory. allowRealFiles : true , // A list of IDs of modules that should remain external to the bundle // See "external" in https://rollupjs.org/#core-functionality external : [ '@angular/core' , '@angular/common' ] , output : { // Format of generated bundle // See "format" in https://rollupjs.org/#core-functionality format : 'es' } } ) ) . pipe ( gulp . dest ( ` ${ distFolder } ${ path } ` ) ) ; }
5. Run rollup inside the /build folder to generate our Flat ES module and place the
generated file into the /dist folder
5 . Run rollup inside the / build folder to generate our Flat ES module and place the generated file into the / dist folder