Skip to content

"Module 'xxx' is not available!" errors when converting from ngAnnotate #41

Open
@uberspeck

Description

@uberspeck

I'm updating libraries on a legacy project. Our build system relies on gulp and i've installed gulp-babel, babel-core etc and the scripts run. However the app fails with Module '[module name]' is not available! errors. I assume that babel is doing more under the hood than ngAnnotate was and it's causing some issues. I've tried changing settings in my .babelrc file, but that hasn't helped. Here's my current configuration.

.babelrc...

{
  "presets": [
    ["env", {
      "targets": {
        "browsers": ["ie >= 10"],
        "modules": false,
        "debug": true
      }
    }]
  ],
  "plugins": ["angularjs-annotate"]
}

application coffee script gulp task...

gulp.task('appJs', function(cb) {

  function templates(){
    return gulp
      .src(['./src/**/*.html'])
      .pipe(changed('./dev/js'))
      .pipe(flatten())
      .pipe(
        htmlmin({
          collapseWhitespace: true,
          removeComments: true,
          removeAttributeQuotes: true
        })
      )
      .pipe(
        angularTemplatecache({
          module: 'pvdm.core.templates'
        })
      )
  }

  function coffeescript(){
    return gulp
      .src(['!./src/**/*spec.coffee','./src/**/*module.coffee','./src/**/*.coffee'])
      .pipe(changed('./dev/js'))
      .pipe(coffee())
      .pipe(babel())
  }

  return eventStream
    .merge(templates(), coffeescript())
    .pipe(concat('app.js'))
    .pipe(gulp.dest('./dev/js'))

});

vendor js gulp task

gulp.task('vendorJs', function(cb){
  return gulp.src(config.vendor_js)
    .pipe(changed('./dev/js'))
    .pipe(concat('vendor.js'))
    .pipe(babel())
    .pipe(gulp.dest('./dev/js'));
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions