mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-24 17:36:00 +00:00
fied require problem in webpacked app
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
node: true,
|
||||
commonjs: true,
|
||||
es6: true,
|
||||
jquery: false,
|
||||
jest: true,
|
||||
jasmine: true,
|
||||
},
|
||||
extends: 'eslint:recommended',
|
||||
globals: {
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly',
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
},
|
||||
rules: {
|
||||
'no-unused-vars': 'warn',
|
||||
},
|
||||
};
|
||||
@@ -12,8 +12,16 @@ function requirePlugin(packageName, requiredPlugin = null) {
|
||||
if (loadedPlugins[packageName]) return loadedPlugins[packageName];
|
||||
|
||||
if (requiredPlugin == null) {
|
||||
console.log('Loading module', packageName);
|
||||
const module = require(path.join(pluginsdir(), packageName, 'dist', 'backend.js'));
|
||||
let module;
|
||||
const modulePath = path.join(pluginsdir(), packageName, 'dist', 'backend.js');
|
||||
console.log(`Loading module ${packageName} from ${modulePath}`);
|
||||
try {
|
||||
// @ts-ignore
|
||||
module = __non_webpack_require__(modulePath);
|
||||
} catch (err) {
|
||||
console.error('Failed load webpacked module', err);
|
||||
module = require(modulePath);
|
||||
}
|
||||
requiredPlugin = module.__esModule ? module.default : module;
|
||||
}
|
||||
loadedPlugins[packageName] = requiredPlugin;
|
||||
|
||||
@@ -14,9 +14,9 @@ var config = {
|
||||
libraryTarget: 'commonjs2',
|
||||
},
|
||||
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
// optimization: {
|
||||
// minimize: false,
|
||||
// },
|
||||
|
||||
// module: {
|
||||
// rules: [
|
||||
@@ -29,7 +29,7 @@ var config = {
|
||||
plugins: [
|
||||
new webpack.IgnorePlugin({
|
||||
checkResource(resource) {
|
||||
const lazyImports = ['pg-native', 'uws'];
|
||||
const lazyImports = ['uws'];
|
||||
if (!lazyImports.includes(resource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user