Skip to content

Webpack 2 TypeError: ngAnnotate options #31

Open
@Darkbladecr

Description

@Darkbladecr

I have tried to migrate to webpack@^2.1.0-beta.27 however I am struggling with a strange options error. This is pointing to the ng-annotate options input is null?

ERROR in ./src/index.js
Module build failed: TypeError: Cannot read property 'list' of null
    at Object.ngAnnotate (/Users/Stefan/Documents/Github/ques_webpack/node_modules/ng-annotate/build/es5/ng-annotate-main.js:1038:16)
 @ multi app

I have attached my truncated webpack config below:

'use strict';
var webpack = require('webpack'),
	path = require('path');

var APP = __dirname + '/src';

var config = {
	context: APP,
	entry: {
		app: [path.join(APP, '/index.js')],
		vendor: [
			'angular',
		]
	},
	plugins: [
		new webpack.optimize.CommonsChunkPlugin({
			name: 'vendor',
			filename: 'vendor.bundle.js'
		})
	],
	module: {
		loaders: [{
			test: /\.js$/,
			exclude: /node_modules|bower_components|libs_modified/,
			use: [
				{
					loader: 'ng-annotate',
					options: {
						es6: true
					}
				},
				'babel-loader',
				'jshint-loader'
			]
		}],
	},
	output: {
		path: APP,
		filename: 'bundle.js'
	}
};

if (process.env.NODE_ENV === 'production') {
	config.devtool = 'sourcemap';
	config.plugins.push(new webpack.DefinePlugin({
		'process.env': {
			'NODE_ENV': JSON.stringify('production')
		}
	}));
	config.plugins.push(new webpack.LoaderOptionsPlugin({
		minimize: true,
		debug: false
	}));
	config.plugins.push(new webpack.optimize.UglifyJsPlugin({
		compress: {
			screw_ie8: true,
			warnings: false
		}
	}));
	config.plugins.push(new webpack.optimize.AggressiveMergingPlugin());
} else {
	config.devtool = 'eval';
	config.entry.app.unshift(
		'webpack/hot/dev-server'
	);
	config.plugins.push(new webpack.HotModuleReplacementPlugin());
}

module.exports = config;

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