dbgate/packages/api/webpack.config.js

56 lines
1009 B
JavaScript
Raw Normal View History

2020-03-14 08:54:34 +00:00
var webpack = require('webpack');
var path = require('path');
var config = {
context: __dirname + '/src',
entry: {
app: './index.js',
},
target: 'node',
2021-01-16 17:55:10 +00:00
node: {
__dirname: false,
},
2020-03-14 08:54:34 +00:00
output: {
path: path.resolve(__dirname, 'dist'),
2020-05-16 06:23:10 +00:00
filename: 'bundle.js',
2020-06-09 18:54:14 +00:00
libraryTarget: 'commonjs2',
2020-03-14 08:54:34 +00:00
},
2020-05-16 06:23:10 +00:00
// optimization: {
// minimize: false,
// },
2020-06-09 18:54:14 +00:00
2021-01-16 17:55:10 +00:00
module: {
rules: [
{
test: /\.node$/,
use: 'node-loader',
},
],
},
2020-03-14 08:54:34 +00:00
plugins: [
new webpack.IgnorePlugin({
checkResource(resource) {
2020-11-26 14:42:50 +00:00
const lazyImports = ['uws'];
2020-03-14 08:54:34 +00:00
if (!lazyImports.includes(resource)) {
return false;
}
try {
require.resolve(resource);
} catch (err) {
return true;
}
return false;
},
}),
],
externals: {
2024-07-31 12:07:49 +00:00
'better-sqlite3': 'commonjs better-sqlite3',
'oracledb': 'commonjs oracledb',
'msnodesqlv8': 'commonjs msnodesqlv8',
},
2020-03-14 08:54:34 +00:00
};
module.exports = config;