Skip to content
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

No name was provided for external module in rollup:umd task #272

Open
sdwallace opened this issue Jan 25, 2018 · 2 comments
Open

No name was provided for external module in rollup:umd task #272

sdwallace opened this issue Jan 25, 2018 · 2 comments

Comments

@sdwallace
Copy link

sdwallace commented Jan 25, 2018

I am getting these 'errors' when I run 'npm run build'. They seem to be warnings as everything works when I use the library but I would like to fix these.

No name was provided for external module '@angular/core' in options.globals - guessing 'core'
No name was provided for external module '@angular/common' in options.globals - guessing 'common'
No name was provided for external module '@angular/router' in options.globals -guessing 'router'
No name was provided for external module 'rxjs/Observable' in options.globals -guessing 'Observable'
No name was provided for external module 'rxjs/Subject' in options.globals - guessing 'Subject'
No name was provided for external module '@angular/platform-browser' in options.globals - guessing 'platformBrowser'
No name was provided for external module '@angular/forms' in options.globals - guessing 'forms'

Can anyone give me guidance?

Here is what my complete gulp task looks like. I changed the task a little as rollup was warning me of some config changes:

gulp.task('rollup:umd', function () {
  return gulp.src(`${buildFolder}/**/*.js`)
  // transform the files here.
    .pipe(rollup({

  // Bundle's entry point
  // See "input" in https://rollupjs.org/#core-functionality
  input: `${buildFolder}/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/platform-browser',
    '@angular/common',
    '@angular/forms',
    '@angular/router',
    'rxjs/Observable',
    'rxjs/Subject'
  ],

   output: {
		// Format of generated bundle
		// See "format" in https://rollupjs.org/#core-functionality
	  
	  format: 'umd',
	  
	  // Export mode to use
	  // See "exports" in https://rollupjs.org/#danger-zone
	  exports: 'named',

	  // The name to use for the module for UMD/IIFE bundles
	  // (required for bundles with exports)
	  // See "name" in https://rollupjs.org/#core-functionality
	  name: 'vueframework',
	  
	  // See "globals" in https://rollupjs.org/#core-functionality
	  globals: {
		typescript: 'ts'
	  }		  
  },




}))
.pipe(rename('vueframework.umd.js'))
.pipe(gulp.dest(distFolder));

});

@caroso1222
Copy link
Contributor

It might be complaining because you're not giving names to those externals in the output.globals prop. Try this:

gulp.task('rollup:umd', function () {
  
  const rollupGlobals = {
    '@angular/core': 'ng.core',
    '@angular/platform-browser': 'ng.platformBrowser',
    '@angular/common': 'ng.common',
    '@angular/forms': 'ng.forms',
    '@angular/router': 'ng.router',
    'rxjs/Observable': 'Rx.Observable',
    'rxjs/Subject': 'Rx.Subject',
    'typescript': 'ts'
  }
  
  return gulp.src(`${buildFolder}/**/*.js`)
  // transform the files here.
    .pipe(rollup({

  // Bundle's entry point
  // See "input" in https://rollupjs.org/#core-functionality
  input: `${buildFolder}/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: Object.keys(rollupGlobals),

   output: {
		// Format of generated bundle
		// See "format" in https://rollupjs.org/#core-functionality
	  
	  format: 'umd',
	  
	  // Export mode to use
	  // See "exports" in https://rollupjs.org/#danger-zone
	  exports: 'named',

	  // The name to use for the module for UMD/IIFE bundles
	  // (required for bundles with exports)
	  // See "name" in https://rollupjs.org/#core-functionality
	  name: 'vueframework',
	  
	  // See "globals" in https://rollupjs.org/#core-functionality
	  globals: rollupGlobals		  
  },




}))
.pipe(rename('vueframework.umd.js'))
.pipe(gulp.dest(distFolder));
});

@sdwallace
Copy link
Author

Thanks @caroso1222 but after making that change, I still get the same warnings. I am noticing that the warning says "options.globals" vs "output.globals". Should I still this definition in a different place?

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

No branches or pull requests

3 participants