我有一个带webpack的小nodejs项目。我对webpack相对较新,所以我认为这就是问题所在。
如果我安装log4js,winston或其他记录器库并运行我正在获取的应用程序
WARNING in ./~/log4js/lib/log4js.js
Critical dependencies:
388:21-38 the request of a dependency is an expression
@ ./~/log4js/lib/log4js.js 388:21-38
WARNING in ./~/log4js/lib/appenders/logstashUDP.js.orig
Module parse failed: /Users/me/Development/jstemplate/node_modules/log4js/lib/appenders/logstashUDP.js.orig Line 31: Unexpected token <<
You may need an appropriate loader to handle this file type.
|
| var logObject = {
| <<<<<<< HEAD
| '@timestamp': (new Date(loggingEvent.startTime)).toISOString(),
| type: type,
@ ./~/log4js/lib/appenders ^\.\/.*$
这是我的webpack配置
var webpack = require('webpack');
var path = require('path');
var APP_DIR = path.join(__dirname, '..', 'src');
var devFlagPlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
});
module.exports = {
debug: true,
devtool: 'eval',
entry: ['webpack-hot-middleware/client', './src/index.tsx'],
module: {
preLoaders: [{
test: /\.tsx?$/,
loader: 'tslint',
include: APP_DIR
}],
loaders: [{
test: /\.tsx?$/,
loaders: ['babel', 'ts'],
include: APP_DIR
}]
},
output: {
filename: 'app.js',
path: path.join(__dirname, '..', 'build'),
publicPath: '/static/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
devFlagPlugin
],
resolve: {
root: [path.resolve('../src')],
extensions: ['', '.jsx', '.js', '.tsx', '.ts', '.json']
},
resolveLoader: {
root: '../node_modules'
},
node: {
fs: "empty"
}
};
答案 0 :(得分:1)
打开此文件。它已损坏。
var logObject = {
<<<<<<< HEAD
'@timestamp': (new Date(loggingEvent.startTime)).toISOString(),
type: type,
message: logMessage,
fields: fields,
category: loggingEvent.logger.category
=======
"@version" : "1",
"@timestamp" : (new Date(loggingEvent.startTime)).toISOString(),
"type" : config.logType ? config.logType : config.category,
"message" : layout(loggingEvent),
"fields" : _.extend(config.fields,
loggingEvent.data.length > 1 ? loggingEvent.data[1] : {},
{'level':loggingEvent.level.levelStr})
>>>>>>> jumpgh-master
};
看起来像合并冲突。看起来这个模块有问题,而不是webpack。