내가 webpack 2
에 typescript 2.2.2
및 babel
로더를 사용하고 node_modules
을 제외하려고 노력하지만, webpack
명령을하려고 할 때 여전히 node_modules에 angular 4.0.0
에서 오류를 얻을 작동하지 node_modules을 제외 할 수 있습니다.웹팩 2 TS-로더
webpack.congfig.js : 웹팩 --progress 명령 후
var path = require('path');
var webpack = require('webpack');
var PROD = true;
module.exports = {
entry: path.join(__dirname, 'ng2', 'src','index.js'),
output: {
path: path.join(__dirname, 'ng2', 'dist'),
filename: 'vendorNG2.js'
},
devtool: 'eval',
resolve: {
extensions: [".tsx", ".ts", ".js"]
},
watch: true,
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: [/node_modules/],
},
{
test: /\.js$/,
exclude: [/node_modules/],
use: {
loader: "babel-loader?cacheDirectory=true",
options: {
presets: ['es2015']
}
}
},
]
},
plugins: PROD ? [
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false }
})
] : []
}
:
...
ERROR in /home/user/Projects/project/front/node_modules/angular2/src/facade/lang.d.ts
(13,17): error TS2693: 'Map' only refers to a type, but is being used as a value here.
ERROR in /home/user/Projects/project/front/node_modules/angular2/src/facade/lang.d.ts
(14,17): error TS2693: 'Set' only refers to a type, but is being used as a value here.
ERROR in ./ng2/src/app/main.ts
(19,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
당신은 오류가 node_modules에서 오는 볼 수 있습니다.
tsconfig.json의 v1의
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react",
"allowJs": true
}
}
tsconfig.json v2를 :
{
"compilerOptions": {
"outDir": "./ng2/dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react",
"type":[],
"allowJs": true
},
"exclude": [
"node_modules"
]
}
V2 오류 :
ERROR in /home/user/Projects/project/front/admin/tsconfig.json
error TS5023: Unknown compiler option 'type'.
@ ./ng2/src/index.js 8:0-21
ERROR in ./ng2/src/app/main.ts
Module build failed: error while parsing tsconfig.json
@ ./ng2/src/index.js 8:0-21
tsconfig.js 추가 v3의 ("experimentalDecorators을"참) 몇 가지 오류가 발생했습니다.
{
"compilerOptions": {
"outDir": "./ng2/dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react",
"experimentalDecorators": true,
"allowJs": true
},
"exclude": [
"node_modules"
]
}
V3 오류 :
... /home/user/Projects/project/front/node_modules/angular2/src/facade/lang.d.ts 에서 ERROR (13, 17) : 오류 TS2693 : '지도'는 유형을 나타낼 뿐이며 여기서 값으로 사용됩니다. /home/user/Projects/project/front/node_modules/angular2/src/facade/lang.d.ts 에서
ERROR (14,17) : 오류 TS2693 '설정은'만 형태를 의미하지만, 여기서 값으로 사용됩니다.
'tsconfig' 모양이 어떻게됩니까? – tymeJV
업데이트 된 소식 –
'experimentalDecorators : true'를'tsconfig'에 추가하려고 했습니까?- 그들이 작동하지 않는다면, "유형"을 추가하십시오 : []' – tymeJV