【发布时间】:2018-07-26 21:39:22
【问题描述】:
这是 Webpack 配置:
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: './server/index.js',
target: 'node',
externals: [nodeExternals()],
output: {
path: __dirname,
filename: 'server.js',
publicPath: '/'
},
module: {
rules: [
{
test: /\.(js)$/,
use: 'babel-loader'
}
]
},
plugins: [
new webpack.DefinePlugin({
__isBrowser__: "false"
})
]
};
我已经像这样配置了 webpack 命令:
NODE_ENV=production node --max-old-space-size=2048 node_modules/webpack/bin/webpack --config webpack.server.js --mode=production
命令 --max-old-space-size 配置了 2 GB 的 RAM,但还不够,我仍然有错误...
我的电脑有 4 GB 的 RAM。
包:
我该如何解决这个问题?
【问题讨论】: