0
我有一個帶有webpack的小nodejs項目。 Iam對webpack比較新,所以我認爲這是問題所在。Webpack:您可能需要一個合適的加載器來處理這種文件類型
如果我安裝log4js,溫斯頓或其他記錄庫和運行我收到
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"
}
};