我使用angular2.0.0-beta.0
在抛出错误时加载ts文件
[200] ./src/app/LoggedInOutlet.ts 2.76 kB {2} [built] [2 errors]
[201] ./src/app/app.ts 1.83 kB {2} [built] [3 errors]
[202] ./src/home/home.ts 2.93 kB {2} [built] [3 errors]
[203] ./src/home/homeSecrets/GetSecrets.ts 2.81 kB {2} [built] [2 errors]
[204] ./src/home/homeSecrets/secrets.ts 1.75 kB {2} [built] [2 errors]
[205] ./src/home/moreTest.ts 1.31 kB {2} [built] [2 errors]
[206] ./src/home/test1/test.ts 1.24 kB {2} [built] [2 errors]
[207] ./src/home/test2/anotherTest.ts 1.3 kB {2} [built] [2 errors]
[208] ./src/home/test3/LastTest.ts 1.33 kB {2} [built] [2 errors]
[209] ./src/index.ts 395 bytes {2} [built] [2 errors]
[210] ./src/login/login.ts 2.57 kB {2} [built] [2 errors]
[211] ./src/signup/signup.ts 2.53 kB {2} [built] [2 errors]
ERROR in ./src/home/homeSecrets/GetSecrets.ts
(4,48): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/home/homeSecrets/secrets.ts
(1,48): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/home/moreTest.ts
(7,48): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/home/test3/LastTest.ts
(4,48): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/home/test2/anotherTest.ts
(7,48): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/home/test1/test.ts
(7,48): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in Z:\a2\typings\_custom\webpack.d.ts
(1,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'require' must be of type 'NodeRequire', but here has type 'any'.
ERROR in Z:\a2\typings\_custom\webpack.d.ts
(4,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'global' must be of type 'Global', but here has type 'any'.
ERROR in ./src/signup/signup.ts
(1,48): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/login/login.ts
(1,31): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/home/home.ts
(1,48): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/home/home.ts
(24,14): error TS2345: Argument of type '({ path: string; redirectTo: string; } | { path: string; as: string; component: typeof Test; })[]' is not assignable to parameter of type 'RouteDefinition[]'.
Type '{ path: string; redirectTo: string; } | { path: string; as: string; component: typeof Test; }' is not assignable to type 'RouteDefinition'.
Type '{ path: string; redirectTo: string; }' is not assignable to type 'RouteDefinition'.
Types of property 'redirectTo' are incompatible.
Type 'string' is not assignable to type 'any[]'.
ERROR in ./src/app/LoggedInOutlet.ts
(1,72): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/app/app.ts
(1,31): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in ./src/app/app.ts
(19,14): error TS2345: Argument of type '({ path: string; redirectTo: string; } | { path: string; as: string; component: typeof Home; } | ...' is not assignable to parameter of type 'RouteDefinition[]'.
Type '{ path: string; redirectTo: string; } | { path: string; as: string; component: typeof Home; } | {...' is not assignable to type 'RouteDefinition'.
Type '{ path: string; redirectTo: string; }' is not assignable to type 'RouteDefinition'.
Types of property 'redirectTo' are incompatible.
Type 'string' is not assignable to type 'any[]'.
ERROR in ./src/index.ts
(1,52): error TS2307: Cannot find module 'angular2/angular2'.
ERROR in multi angular2
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2
@ multi angular2
ERROR in ./src/index.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src
@ ./src/index.ts 1:17-45
ERROR in ./src/app/app.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\app
@ ./src/app/app.ts 10:17-45
ERROR in ./src/app/LoggedInOutlet.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\app
@ ./src/app/LoggedInOutlet.ts 18:17-45
ERROR in ./src/login/login.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\login
@ ./src/login/login.ts 10:17-45
ERROR in ./src/home/home.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\home
@ ./src/home/home.ts 10:17-45
ERROR in ./src/signup/signup.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\signup
@ ./src/signup/signup.ts 10:17-45
ERROR in ./src/home/moreTest.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\home
@ ./src/home/moreTest.ts 13:17-45
ERROR in ./src/home/test1/test.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\home\test1
@ ./src/home/test1/test.ts 13:17-45
ERROR in ./src/home/test2/anotherTest.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\home\test2
@ ./src/home/test2/anotherTest.ts 13:17-45
ERROR in ./src/home/test3/LastTest.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\home\test3
@ ./src/home/test3/LastTest.ts 13:17-45
ERROR in ./src/home/homeSecrets/secrets.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\home\homeSecrets
@ ./src/home/homeSecrets/secrets.ts 15:17-45
ERROR in ./src/home/homeSecrets/GetSecrets.ts
Module not found: Error: Cannot resolve module 'angular2/angular2' in Z:\a2\src\home\homeSecrets
@ ./src/home/homeSecrets/GetSecrets.ts 13:17-45
webpack: bundle is now VALID.
我的webpack.config.js就像休闲一样
var webpack = require('webpack');
var HtmlWebpackPlugin = require("html-webpack-plugin");
var path = require('path');
var sliceArgs = Function.prototype.call.bind(Array.prototype.slice);
module.exports = {
devtool: 'source-map',
// devtool: 'eval',
//
entry: {
angular2: [
// Angular 2 Deps
'zone.js',
'reflect-metadata',
//'./src/common/BrowserDomAdapter',
'angular2/angular2',
'angular2/router',
'angular2/core'
],
app: [
// App
/*
// * include any 3rd party js lib here
*/
'./src/index'
]
},
// Config for our build files
output: {
path: root('build'),
filename: '[name].js',
// filename: '[name].[hash].js',
sourceMapFilename: '[name].js.map',
chunkFilename: '[id].chunk.js'
// publicPath: 'http://mycdn.com/'
},
resolve: {
root: __dirname,
extensions: [
'',
'.ts',
'.js',
'.json',
'.webpack.js',
'.web.js'
],
alias: {
// When Angular2 has a TypeScript build
// we can switch between development and production
// 'angular2': 'angular2/es6/prod',
// 'angular2': 'angular2/es6/dev',
//'webapp': 'src'
}
},
module: {
loaders: [
// Support for *.json files.
{ test: /\.json$/, loader: 'json' },
// Support for CSS as raw text
{ test: /\.css$/, loader: 'raw' },
// support for .html as raw text
{ test: /\.html$/, loader: 'raw' },
// Support for .ts files.
{ test: /\.ts$/, loader: 'ts' }
],
noParse: [
/rtts_assert\/src\/rtts_assert/
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'angular2',
minChunks: Infinity
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
filename: 'common.js'
}),
new webpack.DefinePlugin({
'ENV': {
'type': JSON.stringify('development'),
'debug': true
}
}),
// new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.BannerPlugin(getBanner())
],
// our Development Server configs
devServer: {
inline: true,
colors: true,
historyApiFallback: true,
contentBase: '.',
publicPath: '/build'
},
debug: true,
cache: true,
context: __dirname,
stats: { colors: true, reasons: true }
};
function getBanner() {
return 'A demo project angular2 beta that had covered all functionality(e.g. routing, nested routing, directives, pipe, dependency injection etc) in easy understanding way';
}
function root(args) {
args = sliceArgs(arguments, 0);
return path.join.apply(path, [__dirname].concat(args));
}
function rootNode(args) {
args = sliceArgs(arguments, 0);
return root.apply(path, ['node_modules'].concat(args));
}
**注意:只要我将角度版本更改为" 2.0.0-alpha.44"它工作正常,没有任何错误