babel-plugin-angularjs-annotate icon indicating copy to clipboard operation
babel-plugin-angularjs-annotate copied to clipboard

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

Open uberspeck opened this issue 7 years ago • 2 comments

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'));
});

uberspeck avatar Mar 22 '18 20:03 uberspeck

Having this issue too. How to migrate from old gulp-ng-annotate to this?

binarykitchen avatar Mar 10 '20 20:03 binarykitchen

Not a solution for this issue, but I found an updated version of gulp-ng-annotate

https://github.com/olov/ng-annotate/issues/245#issuecomment-373157859

dv336699 avatar Mar 25 '20 09:03 dv336699