我有2個工作方式不同,我不能告訴有什麼不同。我曾在一個項目中的以下...爲什麼我會在一個webpack項目上獲得「意外的令牌導入」,但卻沒有獲得「意外的令牌導入」?
// In .ts wile
import 'core-js/es6';
import 'reflect-metadata';
這在一個項目上的偉大工程,但是,與同tsconfig.json和typings.json還有TS-裝載機另一個項目中的WebPack配置配置我得到...
Uncaught SyntaxError: Unexpected token import
的transpiled JS就沒有一個看起來像這樣...
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {import 'core-js/es6';
import 'reflect-metadata';
我會後的後續項目之一位
所以我的問題是我錯過了什麼?打字稿定義沒有正確導入?我已經嘗試再次運行typings install
,只是爲了排除這一點。
更多信息
//tsconfig
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
// Typings.json
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160621231320"
}
}
那麼,什麼是這兩個項目之間有什麼不同?它看起來像打字稿在打包之前不會被編譯。 – Bergi
我同意,但它編譯罰款第一個項目 – Jackie
任何機會的webpack配置? –