我想設置角2與webpack 2 但我得到構建錯誤。角2 Webpack 2錯誤找不到名稱'全球'
我剛剛導入@ angular/platform-browser-dynamic 但是它在屏幕上顯示了很多錯誤。無法找到模塊'錯誤找不到名稱'全球'。'是其中之一
錯誤在C:\ Users \ T12449 \ Desktop \ angular \ hello-angular \ node_modules \ zone.js \ lib \ zone-spec \ wtf.ts (156,80):錯誤TS2304:找不到名稱'全球'。
ERROR在C:\用戶\ T12449 \桌面\角\你好棱角\ node_modules \ zone.js \ lib中\區規格\假異步-test.ts (268,80):錯誤TS2304:找不到名稱'全球'。
錯誤在C:\用戶\ T12449 \桌面\角\ HELLO-角\ node_modules \ zone.js \ LIB \節點\ node.ts (18,93):錯誤TS2304:找不到名稱 '全球' 。
我webpack.config.js
module.exports = {
entry: './src/main.ts',
output: {
filename: '[name].[ext]'
},
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
module: {
loaders: [
{ test: /\.tsx?$/, loader: 'ts-loader' }
]
}
}
的package.json
{
"name": "hello-angular",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/core-js": "^0.9.41",
"ts-loader": "^2.0.3",
"typescript": "^2.2.2",
"webpack": "^2.3.3",
"webpack-dev-server": "^2.4.2"
},
"dependencies": {
"@angular/common": "^4.0.1",
"@angular/compiler": "^4.0.1",
"@angular/core": "^4.0.1",
"@angular/platform-browser": "^4.0.1",
"@angular/platform-browser-dynamic": "^4.0.1",
"rxjs": "^5.0.1",
"zone.js": "^0.8.4"
}
}
main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
const a :number = 0;
tsconfig.json
{
"compilerOptions": {
"removeComments": true,
"sourceMap": false,
"module": "commonjs",
"noImplicitAny": false,
"target": "es2015",
"typeRoots": [
"../node_modules/@types"
],
"types": [
"core-js"
]
},
"exclude": [
"../node_modules"
]
}