2016-12-22 9 views
2

Typescript 2.0.10から2.1.4へのアップグレードは、webpack、webpack-stream、ts-loader、またはgulpの中で、エントリポイントを尊重しないため、ガルプソースグロブ。/clientとapp.tsのtsファイルだけでなく、gulp.srcとWeb Packのエントリポイントごとに、私のプロジェクト(/ serverソースフォルダ内のものを含む)にすべての.tsファイルを含めるように見えます。私はこれを行う必要がある別の/新しい/より良い方法はありますか?ウェブパックの設定でTypeScript 2.1.4 webpack ts-loaderの変更点

const serverPath = 'server'; 
const clientPath = 'client'; 
const buildPath = 'build'; 
const paths = { 
    server: { 
     scripts: [ 
      `${serverPath}/**/*.ts` 
     ] 
    }, 
    client: { 
     files: [ 
      `${clientPath}/**/*` 
     ], 
     scripts: [ 
      `${clientPath}/**/*.ts` 
     ], 
     entry: `${clientPath}/app.ts` 
    } 
}; 


gulp.task('build:client', cb => { 
    gulp.src(paths.client.entry) 
     .pipe(webpackStream(webpackConfig, webpack)) 
     .pipe(gulp.dest(`${buildPath}/${clientPath}`)); 
    cb(); 
}); 

:tsconfig.jsonで

entry: { 
    app: './client/app.ts' 
} 

ts: { 
    configFileName: './tsconfig.json' 
} 

resolve: { 
    extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js'] 
} 

module: { 
    loaders: [ 
     { test: /\.ts$/, loader: 'ng-annotate-loader!ts-loader' } 
    ] 
} 

:2.0.10を使用して

{ 
    "compilerOptions": { 
     "module": "commonjs", 
     "target": "es6", 
     "removeComments": false, 
     "noImplicitAny": true, 
     "sourceMap": true, 
     "inlineSources": true, 
     "experimentalDecorators": true, 
     "emitDecoratorMetadata": true 
    } 
} 

出力:

ts-loader: Using [email protected] and /Users/chris/code/class-app/tsconfig.json 
[20:47:36] Version: webpack 1.14.0 
Asset  Size Chunks    Chunk Names 
app.js.map 950 bytes  0 [emitted] app 
app.js 550 bytes  0 [emitted] app 
一気ファイル内

.1.4を使用して

出力:

ts-loader: Using [email protected] and /Users/chris/code/class-app/tsconfig.json 
server/api/thing/thing.controller.ts(17,16): error TS2322: <ts error in server portion, not relevant> 
[20:53:03] TypeScript: 1 semantic error 
[20:53:03] TypeScript: emit succeeded (with errors) 
Unhandled rejection Error in plugin 'webpack-stream' 
Message: 
/Users/chris/code/class-app/server/api/thing/thing.controller.ts <same as above> 
+1

なぜエラーは関係ないと思いますか?それは私にとって非常に関連しているように見えます。あなたのtypescriptは2.1.4では無効ですが、2.0.10ではありません – Rob

+1

最初にサーバtsをコンパイルすることは想定されていません(クライアントtsのみ)。 –

答えて

2

どうやら問題は、サーバーコードに、この全体の時間をWebPACKの中に活字体で実行されていている(それがされているべきではありませんが)、私は、サーバーを修正することを計画していたものの、 TSの問題はTypeScriptのアップグレードが導入されたこと、WebPackが実際に公開していたことは、それがすべてではないはずのファイルをコンパイルしていたことです。以前の(動作していた)TypeScriptのサーバーtsに意図的に問題を導入し、同じエラーが発生したことをテストしました。

私はまだ/ clientにあるものだけでなく、すべてのTSファイルをコンパイルしようとしているのですが、それについて新しい質問をします。

関連する問題