我的webpack.config.js:
const path = require('path');
var fs = require('fs')
var nodeModules = {};
fs.readdirSync('node_modules').filter(function (x) {return ['.bin'].indexOf(x) === -1;}).forEach(function (mod){nodeModules[mod]= 'commonjs ' + mod;
});
module.exports = {
mode: 'development',
target: 'node',
entry: './src/server,ts',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.node$/,
loader: 'node-loader',
},
],
},
externals: [nodeModules],
devtool: 'source-map',
};
字符串
我的webpack.js.js文件有问题。当我运行npm run build时,它被配置为执行webpack,我遇到了与模块相关的错误。其中一个错误是:
ERROR in ./node_modules/sequelize/lib/dialects/postgres/hstore.js 2:15-35
Module not found: Error: Can't resolve 'pg-hstore' in 'C:\..\node_modules\sequelize\lib\dialects\postgres'
resolve 'pg-hstore' in 'C:\..\node_modules\sequelize\lib\dialects\postgres'
Parsed request is a module
型
1条答案
按热度按时间mutmk8jj1#
我通过编辑webpack.config.js解决了这个问题
字符串