Skip to content

Commit fe465a3

Browse files
committed
fix(build): fixed ng-annotate to work with tree-shaking enabled (webpack 2 loader replaced with Babel plugin)
1 parent c5350fd commit fe465a3

10 files changed

Lines changed: 13 additions & 10 deletions

File tree

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"presets": [
33
["es2015", { "modules": false }]
44
],
5+
"plugins": [
6+
"angularjs-annotate"
7+
],
58
"env": {
69
"test": {
710
"plugins": [

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"clean-webpack-plugin": "^0.1.14",
2828
"css-loader": "^0.26.0",
2929
"eslint": "^3.10.2",
30+
"babel-plugin-angularjs-annotate": "0.7.0",
3031
"babel-preset-es2015": "^6.22.0",
3132
"eslint-config-angular": "^0.5.0",
3233
"eslint-loader": "^1.6.1",
@@ -44,7 +45,6 @@
4445
"karma-phantomjs-launcher": "^1.0.2",
4546
"karma-sourcemap-loader": "^0.3.7",
4647
"karma-webpack": "^1.8.0",
47-
"ng-annotate-loader": "^0.2.0",
4848
"ngtemplate-loader": "^1.3.1",
4949
"node-sass": "^3.13.0",
5050
"postcss-loader": "^1.1.1",

src/app/common/nav/nav.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class AppNavController {
2+
/* @ngInject */
23
constructor (conf) {
3-
'ngInject';
44
this.conf = conf;
55

66
console.time('App init');

src/app/components/about/about.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class AboutController {
2+
/* @ngInject */
23
constructor () {
3-
'ngInject';
44
this.title = 'About';
55
}
66

src/app/components/about/about.module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import angular from 'angular';
22
import { AboutComponent } from './about.component';
33
import './about.scss';
44

5+
/* @ngInject */
56
const config = ($stateProvider) => {
6-
'ngInject';
77
let about = {
88
name: 'about',
99
url: '/about',

src/app/components/home/home.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class HomeController {
2+
/* @ngInject */
23
constructor () {
3-
'ngInject';
44
this.title = 'Home';
55
}
66

src/app/components/home/home.module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import angular from 'angular';
22
import { HomeComponent } from './home.component';
33
import './home.scss';
44

5+
/* @ngInject */
56
const config = ($stateProvider) => {
6-
'ngInject';
77
let home = {
88
name: 'home',
99
url: '/home',

src/app/root.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class RootController {
2+
/* @ngInject */
23
constructor ($transitions) {
3-
'ngInject';
44
this.$transitions = $transitions;
55

66
console.time('App init');

src/app/root.module.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { ComponentsModule } from './components/components.module';
66
import { CommonModule } from './common/common.module';
77
import '../sass/main.scss';
88

9+
/* @ngInject */
910
const config = ($compileProvider, $stateProvider, $urlRouterProvider) => {
10-
'ngInject';
1111
$urlRouterProvider.otherwise('/home');
1212

1313
// https://medium.com/swlh/improving-angular-performance-with-1-line-of-code-a1fb814a6476
@@ -23,8 +23,8 @@ const config = ($compileProvider, $stateProvider, $urlRouterProvider) => {
2323
// });
2424
};
2525

26+
/* @ngInject */
2627
const run = ($rootScope, $state, $stateParams) => {
27-
'ngInject';
2828
$rootScope.$state = $state;
2929
$rootScope.$stateParams = $stateParams;
3030
};

webpack.base.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = {
4040

4141
{
4242
test: /\.js$/,
43-
loaders: ['ng-annotate-loader', 'babel-loader', 'eslint-loader'],
43+
loaders: ['babel-loader', 'eslint-loader'],
4444
exclude: /node_modules/
4545
},
4646

0 commit comments

Comments
 (0)