Angular grunt build (from yeoman) breaks my app

后端 未结 5 1992
野趣味
野趣味 2021-01-12 09:33

after running the build from the /dist folder I get:

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.1/$injector/modulerr?p         


        
5条回答
  •  独厮守ぢ
    2021-01-12 10:00

    I think the default GruntFile.js has changed a bit in Yeoman since this question was answered.

    This worked for me:

    Uncommented out the following uglify block and added the mangle:false option.

    uglify: {
       options:{mangle:false},
       dist: {
         files: {
           '<%= yeoman.dist %>/scripts/scripts.js': [
             '<%= yeoman.dist %>/scripts/scripts.js'
           ]
         }
       }
    },
    

    Then I commented out the ngmin line (which took forever to run anyway).

    The result is non-mangled js which is considerably larger, but runs my angular code well. Eventually I suppose ngmin will be smart enough to handle things more seamlessly, but until then I'm okay with the extra bytes.

提交回复
热议问题