【发布时间】:2015-12-09 20:09:30
【问题描述】:
我在我的应用程序的后端 (nodejs) 上使用 webpack,主要是将我的 .ts 转换为 .js。但它不起作用。它处理需要控制器文件夹的 app.ts,但 webpack 抱怨:
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 })
]
}
];
我哪里错了?
【问题讨论】:
标签: node.js webpack visual-studio-code