仅 Mac 上的 TypeScript 重复问题(webpack 编译)
TypeScript duplication issue on Mac only (webpack compilation)
我有一个 TypeScript 应用程序。
我用 webpack 编译,在 Windows 下我没有任何问题。
在 MacOS 下,由于 node_modules
文件夹,我有数千个错误。
你能帮我理解为什么我可以在 Windows 上编译但不能在 MacOS 上编译吗?
我的软件包版本在 OS 上是相同的:TypeScript 2.1.1
、Webpack 1.13.3
,并且模块在 yarn.lock
的帮助下具有完全相同的版本。
这里是 tsconfig.json
:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"compileOnSave": false
}
这里是 webpack.config.js
:
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
'app': [
'core-js/client/shim.min.js',
'zone.js/dist/zone',
'./src/app/main.ts'
]
},
output: {
path: './www',
filename: '[name].js'
},
module: {
loaders: [
{test: /\.component.ts$/, loader: 'ts!angular2-template'},
{test: /\.ts$/, exclude: /\.component.ts$/, loader: 'ts'},
{test: /\.html$/, loader: 'raw'}
]
},
resolve: {
extensions: ['', '.js', '.ts']
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
},
minimize: true
}),
new HtmlWebpackPlugin({
template: './src/index.html'
}),
new webpack.ContextReplacementPlugin(/moment[\/\]locale$/, /en-gb\.js|fr\.js/)
]
};
这里是 webpack
输出的开头(几行因为有 10300 行错误):
ts-loader: Using typescript@2.1.1 and /Users/yolo/Documents/app1/tsconfig.json
Hash: 3b637fc56087f3ccacc8
Version: webpack 1.13.3
Time: 27898ms
Asset Size Chunks Chunk Names
app.js 915 kB 0 [emitted] app
index.html 1 kB [emitted]
[0] multi app 52 bytes {0} [built]
[27] ./src/app/app.module.js 4.55 kB {0} [built]
[33] ./src/app/request/request.service.js 3.19 kB {0} [built]
[34] ./src/app/system/system.js 269 bytes {0} [built]
[63] ./src/app/app.component.js 1.19 kB {0} [built]
[64] ./src/app/rxjs-operators.js 347 bytes {0} [built]
[85] ./src/app/app.routing.js 1.4 kB {0} [built]
[86] ./src/app/login/login.component.js 8.95 kB {0} [built]
[87] ./src/app/navbar/navbar.service.js 4.25 kB {0} [built]
[88] ./src/app/account/account.service.js 1.98 kB {0} [built]
[89] ./src/app/location/location.service.js 2.56 kB {0} [built]
[90] ./src/app/storage/storage.service.js 6.8 kB {0} [built]
[91] ./src/app/version/version.service.js 1.4 kB {0} [built]
[92] ./src/app/download/download.service.js 1.41 kB {0} [built]
[93] ./src/app/page-dialog/page-dialog.service.js 2.93 kB {0} [built]
[94] ./src/app/pages/pages.service.js 9.54 kB {0} [built]
[100] ./src/app/slideshow/slideshow.component.js 2.19 kB {0} [built]
[101] ./src/app/logout/logout.component.js 2.27 kB {0} [built]
[102] ./src/app/proceeded-pages/proceeded-pages.component.js 2.92 kB {0} [built]
[103] ./src/app/pages/pages.component.js 3.38 kB {0} [built]
[104] ./src/app/planning/planning.component.js 3.05 kB {0} [built]
[105] ./src/app/planning/planning.service.js 4.04 kB {0} [built]
[106] ./src/app/init/init.component.js 11.6 kB {0} [built]
[107] ./src/app/navbar/navbar.component.js 2.54 kB {0} [built]
[108] ./src/app/page/page.component.js 3.08 kB {0} [built]
[109] ./src/app/page/page.js 122 bytes {0} [built]
[110] ./src/app/login/login-form/login-form.component.js 2.87 kB {0} [built]
[111] ./src/app/login/login.js 203 bytes {0} [built]
[112] ./src/app/directives/c7z-container.directive.js 1.81 kB {0} [built]
[113] ./src/app/directives/c7z-full-height.directive.js 1.61 kB {0} [built]
[114] ./src/app/page-dialog/page-dialog.component.js 4.18 kB {0} [built]
+ 84 hidden modules
ERROR in /Users/yolo/Documents/app1/www/node_modules/zone.js/dist/zone.js.d.ts
(122,11): error TS2451: Cannot redeclare block-scoped variable 'Zone'.
ERROR in /Users/yolo/Documents/app1/www/node_modules/zone.js/dist/zone.js.d.ts
(367,14): error TS2300: Duplicate identifier 'HasTaskState'.
ERROR in /Users/yolo/Documents/app1/www/node_modules/zone.js/dist/zone.js.d.ts
(376,14): error TS2300: Duplicate identifier 'TaskType'.
ERROR in /Users/yolo/Documents/app1/www/node_modules/zone.js/dist/zone.js.d.ts
(462,15): error TS2451: Cannot redeclare block-scoped variable 'Zone'.
ERROR in /Users/yolo/Documents/app1/typings/globals/phonegap-plugin-push/index.d.ts
(4,7): error TS2300: Duplicate identifier 'EventResponse'.
ERROR in /Users/yolo/Documents/app1/typings/globals/phonegap-plugin-push/index.d.ts
(190,3): error TS2374: Duplicate string index signature.
ERROR in /Users/yolo/Documents/app1/typings/globals/phonegap-plugin-push/index.d.ts
(250,3): error TS2374: Duplicate string index signature.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'main' must be of type 'any', but here has type 'NodeModule'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(57,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'parent' must be of type 'any', but here has type 'NodeModule'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(58,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'children' must be of type 'any[]', but here has type 'NodeModule[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(78,6): error TS2300: Duplicate identifier 'BufferEncoding'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(227,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'errno' must be of type 'string', but here has type 'number'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(234,18): error TS2300: Duplicate identifier 'EventEmitter'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(522,26): error TS2300: Duplicate identifier 'Buffer'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(522,50): error TS2300: Duplicate identifier 'SlowBuffer'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(543,18): error TS2300: Duplicate identifier 'EventEmitter'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(543,18): error TS2415: Class 'EventEmitter' incorrectly extends base class 'NodeJS.EventEmitter'.
Types of property 'eventNames' are incompatible.
Type '() => (string | symbol)[]' is not assignable to type '() => string[]'.
Type '(string | symbol)[]' is not assignable to type 'string[]'.
Type 'string | symbol' is not assignable to type 'string'.
Type 'symbol' is not assignable to type 'string'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(654,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'httpVersionMajor' must be of type 'string', but here has type 'number'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(655,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'httpVersionMinor' must be of type 'string', but here has type 'number'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(656,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'connection' must be of type 'any', but here has type 'Socket'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(706,18): error TS2300: Duplicate identifier 'Agent'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(761,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'addressType' must be of type 'string', but here has type 'number | "udp4" | "udp6"'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(764,18): error TS2300: Duplicate identifier 'Worker'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(1485,18): error TS2300: Duplicate identifier 'Script'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2016,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'type' must be of type 'string', but here has type '"udp4" | "udp6"'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2432,22): error TS2451: Cannot redeclare block-scoped variable 'constants'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2787,18): error TS2300: Duplicate identifier 'TLSSocket'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2984,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'pfx' must be of type 'any', but here has type 'string | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2985,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'key' must be of type 'any', but here has type 'string | any[] | string[] | Buffer'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2987,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'cert' must be of type 'any', but here has type 'string | string[] | Buffer | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2988,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'ca' must be of type 'any', but here has type 'string | string[] | Buffer | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2989,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'crl' must be of type 'any', but here has type 'string | string[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2991,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'honorCipherOrder' must be of type 'any', but here has type 'boolean'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2994,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'NPNProtocols' must be of type 'any', but here has type 'string[] | Buffer'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(3011,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'key' must be of type 'string | Buffer', but here has type 'string | string[] | Buffer | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(3013,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'cert' must be of type 'string | Buffer', but here has type 'string | string[] | Buffer | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(3014,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'ca' must be of type '(string | Buffer)[]', but here has type 'string | Buffer | (string | Buffer)[]'.
我不能肯定地说,因为我需要更多错误日志文件,但似乎 webpack 正在编译来自 /node_modules
以及 typings
以及您的应用程序的打字稿定义.由于存在关于重复标识符的错误,这让我认为在 node_modules
和 typings
中都可以找到一些定义。您可以尝试从编译中排除 node_modules
定义,看看是否有所不同。为此,将以下内容添加到 tsconfig.json
:
"compilerOptions": {
...
},
"exclude": [
"node_modules"
]
同样,我不能肯定地说这就是问题所在,更多的是猜测。另外,我不确定为什么这适用于 windows 而不是 Mac.
我有一个 TypeScript 应用程序。
我用 webpack 编译,在 Windows 下我没有任何问题。
在 MacOS 下,由于 node_modules
文件夹,我有数千个错误。
你能帮我理解为什么我可以在 Windows 上编译但不能在 MacOS 上编译吗?
我的软件包版本在 OS 上是相同的:TypeScript 2.1.1
、Webpack 1.13.3
,并且模块在 yarn.lock
的帮助下具有完全相同的版本。
这里是 tsconfig.json
:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"compileOnSave": false
}
这里是 webpack.config.js
:
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
'app': [
'core-js/client/shim.min.js',
'zone.js/dist/zone',
'./src/app/main.ts'
]
},
output: {
path: './www',
filename: '[name].js'
},
module: {
loaders: [
{test: /\.component.ts$/, loader: 'ts!angular2-template'},
{test: /\.ts$/, exclude: /\.component.ts$/, loader: 'ts'},
{test: /\.html$/, loader: 'raw'}
]
},
resolve: {
extensions: ['', '.js', '.ts']
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
},
minimize: true
}),
new HtmlWebpackPlugin({
template: './src/index.html'
}),
new webpack.ContextReplacementPlugin(/moment[\/\]locale$/, /en-gb\.js|fr\.js/)
]
};
这里是 webpack
输出的开头(几行因为有 10300 行错误):
ts-loader: Using typescript@2.1.1 and /Users/yolo/Documents/app1/tsconfig.json
Hash: 3b637fc56087f3ccacc8
Version: webpack 1.13.3
Time: 27898ms
Asset Size Chunks Chunk Names
app.js 915 kB 0 [emitted] app
index.html 1 kB [emitted]
[0] multi app 52 bytes {0} [built]
[27] ./src/app/app.module.js 4.55 kB {0} [built]
[33] ./src/app/request/request.service.js 3.19 kB {0} [built]
[34] ./src/app/system/system.js 269 bytes {0} [built]
[63] ./src/app/app.component.js 1.19 kB {0} [built]
[64] ./src/app/rxjs-operators.js 347 bytes {0} [built]
[85] ./src/app/app.routing.js 1.4 kB {0} [built]
[86] ./src/app/login/login.component.js 8.95 kB {0} [built]
[87] ./src/app/navbar/navbar.service.js 4.25 kB {0} [built]
[88] ./src/app/account/account.service.js 1.98 kB {0} [built]
[89] ./src/app/location/location.service.js 2.56 kB {0} [built]
[90] ./src/app/storage/storage.service.js 6.8 kB {0} [built]
[91] ./src/app/version/version.service.js 1.4 kB {0} [built]
[92] ./src/app/download/download.service.js 1.41 kB {0} [built]
[93] ./src/app/page-dialog/page-dialog.service.js 2.93 kB {0} [built]
[94] ./src/app/pages/pages.service.js 9.54 kB {0} [built]
[100] ./src/app/slideshow/slideshow.component.js 2.19 kB {0} [built]
[101] ./src/app/logout/logout.component.js 2.27 kB {0} [built]
[102] ./src/app/proceeded-pages/proceeded-pages.component.js 2.92 kB {0} [built]
[103] ./src/app/pages/pages.component.js 3.38 kB {0} [built]
[104] ./src/app/planning/planning.component.js 3.05 kB {0} [built]
[105] ./src/app/planning/planning.service.js 4.04 kB {0} [built]
[106] ./src/app/init/init.component.js 11.6 kB {0} [built]
[107] ./src/app/navbar/navbar.component.js 2.54 kB {0} [built]
[108] ./src/app/page/page.component.js 3.08 kB {0} [built]
[109] ./src/app/page/page.js 122 bytes {0} [built]
[110] ./src/app/login/login-form/login-form.component.js 2.87 kB {0} [built]
[111] ./src/app/login/login.js 203 bytes {0} [built]
[112] ./src/app/directives/c7z-container.directive.js 1.81 kB {0} [built]
[113] ./src/app/directives/c7z-full-height.directive.js 1.61 kB {0} [built]
[114] ./src/app/page-dialog/page-dialog.component.js 4.18 kB {0} [built]
+ 84 hidden modules
ERROR in /Users/yolo/Documents/app1/www/node_modules/zone.js/dist/zone.js.d.ts
(122,11): error TS2451: Cannot redeclare block-scoped variable 'Zone'.
ERROR in /Users/yolo/Documents/app1/www/node_modules/zone.js/dist/zone.js.d.ts
(367,14): error TS2300: Duplicate identifier 'HasTaskState'.
ERROR in /Users/yolo/Documents/app1/www/node_modules/zone.js/dist/zone.js.d.ts
(376,14): error TS2300: Duplicate identifier 'TaskType'.
ERROR in /Users/yolo/Documents/app1/www/node_modules/zone.js/dist/zone.js.d.ts
(462,15): error TS2451: Cannot redeclare block-scoped variable 'Zone'.
ERROR in /Users/yolo/Documents/app1/typings/globals/phonegap-plugin-push/index.d.ts
(4,7): error TS2300: Duplicate identifier 'EventResponse'.
ERROR in /Users/yolo/Documents/app1/typings/globals/phonegap-plugin-push/index.d.ts
(190,3): error TS2374: Duplicate string index signature.
ERROR in /Users/yolo/Documents/app1/typings/globals/phonegap-plugin-push/index.d.ts
(250,3): error TS2374: Duplicate string index signature.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'main' must be of type 'any', but here has type 'NodeModule'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(57,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'parent' must be of type 'any', but here has type 'NodeModule'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(58,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'children' must be of type 'any[]', but here has type 'NodeModule[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(78,6): error TS2300: Duplicate identifier 'BufferEncoding'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(227,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'errno' must be of type 'string', but here has type 'number'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(234,18): error TS2300: Duplicate identifier 'EventEmitter'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(522,26): error TS2300: Duplicate identifier 'Buffer'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(522,50): error TS2300: Duplicate identifier 'SlowBuffer'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(543,18): error TS2300: Duplicate identifier 'EventEmitter'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(543,18): error TS2415: Class 'EventEmitter' incorrectly extends base class 'NodeJS.EventEmitter'.
Types of property 'eventNames' are incompatible.
Type '() => (string | symbol)[]' is not assignable to type '() => string[]'.
Type '(string | symbol)[]' is not assignable to type 'string[]'.
Type 'string | symbol' is not assignable to type 'string'.
Type 'symbol' is not assignable to type 'string'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(654,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'httpVersionMajor' must be of type 'string', but here has type 'number'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(655,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'httpVersionMinor' must be of type 'string', but here has type 'number'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(656,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'connection' must be of type 'any', but here has type 'Socket'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(706,18): error TS2300: Duplicate identifier 'Agent'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(761,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'addressType' must be of type 'string', but here has type 'number | "udp4" | "udp6"'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(764,18): error TS2300: Duplicate identifier 'Worker'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(1485,18): error TS2300: Duplicate identifier 'Script'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2016,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'type' must be of type 'string', but here has type '"udp4" | "udp6"'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2432,22): error TS2451: Cannot redeclare block-scoped variable 'constants'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2787,18): error TS2300: Duplicate identifier 'TLSSocket'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2984,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'pfx' must be of type 'any', but here has type 'string | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2985,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'key' must be of type 'any', but here has type 'string | any[] | string[] | Buffer'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2987,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'cert' must be of type 'any', but here has type 'string | string[] | Buffer | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2988,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'ca' must be of type 'any', but here has type 'string | string[] | Buffer | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2989,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'crl' must be of type 'any', but here has type 'string | string[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2991,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'honorCipherOrder' must be of type 'any', but here has type 'boolean'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(2994,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'NPNProtocols' must be of type 'any', but here has type 'string[] | Buffer'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(3011,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'key' must be of type 'string | Buffer', but here has type 'string | string[] | Buffer | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(3013,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'cert' must be of type 'string | Buffer', but here has type 'string | string[] | Buffer | Buffer[]'.
ERROR in /Users/yolo/Documents/app1/typings/globals/node/index.d.ts
(3014,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'ca' must be of type '(string | Buffer)[]', but here has type 'string | Buffer | (string | Buffer)[]'.
我不能肯定地说,因为我需要更多错误日志文件,但似乎 webpack 正在编译来自 /node_modules
以及 typings
以及您的应用程序的打字稿定义.由于存在关于重复标识符的错误,这让我认为在 node_modules
和 typings
中都可以找到一些定义。您可以尝试从编译中排除 node_modules
定义,看看是否有所不同。为此,将以下内容添加到 tsconfig.json
:
"compilerOptions": {
...
},
"exclude": [
"node_modules"
]
同样,我不能肯定地说这就是问题所在,更多的是猜测。另外,我不确定为什么这适用于 windows 而不是 Mac.