2015-12-09 29 views
0

我在我的應用程序的後端(nodejs)上使用webpack,主要是將我的.ts轉儲到.js。它雖然沒有工作。它處理這需要控制器文件夾中的app.ts,但抱怨的WebPack:webpack沒有像我預期的那樣對我的.ts進行轉儲

ERROR in ./app.ts 
Module not found: Error: Cannot resolve 'file' or 'directory' ./controllers in C:\Users\markn\Documents\source\ftct 
@ ./app.ts 3:18-42 

我webpack.config.js的提取物看起來是這樣的:

module.exports = [{ 
    { 
     // back end 
     context: app, 
     entry: { 
      app: ['webpack/hot/dev-server', './app.ts'] 
     }, 
     target: 'node', 
     devtool: 'source-map', 
     output: { 
      path: app, 
      filename: 'app.js' 
     }, 
     externals: nodeModules, 
     module: { 
      loaders: [ 
       { test: /\.ts(x?)$/, loader: 'babel-loader!ts-loader' }, 
       { test: /\.js$/, loader: 'ng-annotate!babel!jshint', exclude: /node_modules/ }, 
       { test: /\.json$/, loader: 'json-loader' } 
      ] 
     }, 
     plugins: [ 
      new webpack.BannerPlugin('require("source-map-support").install();', 
       { raw: true, entryOnly: false }) 
     ] 
    } 
]; 

我要去哪裏錯了?

回答

0

不用擔心,找到了答案。那麼,在盯着代碼的時候偶然發現了它。我錯過了我的配置:

resolve: { 
    extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js'] 
} 
相關問題