Created
July 20, 2017 17:08
-
-
Save imsurinder90/a5ebf5690336667f2fb9679eb3c95a2e to your computer and use it in GitHub Desktop.
pgAdmin4 webpack configuration files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env node */ | |
// Import file, libraries and plugins | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const sourceDir = __dirname + '/pgadmin/static'; | |
// webpack.shim.js contains path references for resolve > alias configuration | |
// and other util function used in CommonsChunksPlugin. | |
const webpackShimConfig = require('./webpack.shim'); | |
const PRODUCTION = process.env.NODE_ENV === 'production'; | |
const envType = PRODUCTION ? 'prod': 'dev'; | |
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | |
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const extractStyle = new ExtractTextPlugin('style.css'); | |
const extractSass = new ExtractTextPlugin('pgadmin.css'); | |
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin'); | |
// Extract vendor related libraries(node_modules/lib/lib.js) from bundles | |
// specified in `chunks` into vendor.js bundle | |
const vendorChunks = new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendor', | |
chunks: ['app.bundle', 'sqleditor', 'codemirror', 'debugger_direct'], | |
filename: 'vendor.js', | |
minChunks: function(module) { | |
return webpackShimConfig.isExternal(module); | |
}, | |
}); | |
// Extract pgAdmin common libraries(pgadmin/web/module/filename.js) from bundles | |
// specified in `chunks` into pgadmin_commons.js bundle. | |
// pgLibs holds files that will be moved into this bundle. | |
const pgAdminCommonChunks = new webpack.optimize.CommonsChunkPlugin({ | |
name: 'pgadmin_commons', | |
chunks: ['app.bundle', 'sqleditor', 'codemirror', 'debugger_direct'], | |
filename: 'pgadmin_commons.js', | |
minChunks: function(module) { | |
return webpackShimConfig.isPgAdminLib(module); | |
}, | |
}); | |
// Expose libraries in app context so they need not to | |
// require('libname') when used in a module | |
const providePlugin = new webpack.ProvidePlugin({ | |
$: 'jquery', | |
jQuery: 'jquery', | |
'window.jQuery': 'jquery', | |
_: 'underscore', | |
S: 'underscore.string', | |
Backbone: 'backbone', | |
Backgrid: 'backgrid', | |
pgAdmin: 'pgadmin', | |
}); | |
// Minify and omptimize JS/CSS to reduce bundle size. It is used in production | |
const uglifyPlugin = new webpack.optimize.UglifyJsPlugin({ | |
output: {comments: false}, | |
compress: { | |
warnings: true, | |
unused: true, | |
dead_code: true, | |
drop_console: true, | |
}, | |
}); | |
// Optimize CSS Assets by removing comments while bundling | |
const optimizeAssetsPlugin = new OptimizeCssAssetsPlugin({ | |
assetNameRegExp: /\.css$/g, | |
cssProcessor: require('cssnano'), | |
cssProcessorOptions: { discardComments: {removeAll: true } }, | |
canPrint: true, | |
}); | |
// Helps in minimising the `React' production bundle. Bundle only code | |
// requires in production mode. React keeps the code conditional | |
// based on 'NODE_ENV' variable. [used only in production] | |
const definePlugin = new webpack.DefinePlugin({ | |
'process.env': { | |
'NODE_ENV': JSON.stringify('production'), | |
}, | |
}); | |
// Manages the cache and stores it into 'sources/generated/.cache/<env><hash>/' path | |
// where env = dev || prod | |
const hardSourceWebpackPlugin = new HardSourceWebpackPlugin({ | |
cacheDirectory: './.cache/hard-source/' + envType +'/[confighash]', | |
recordsPath: './.cache/hard-source/' + envType +'/[confighash]/records.json', | |
configHash: require('node-object-hash')({sort: false}).hash, | |
environmentHash: { | |
root: process.cwd(), | |
directories: ['node_modules'], | |
files: ['package.json'], | |
}, | |
}); | |
module.exports = { | |
stats: { children: false }, | |
// The base directory, an absolute path, for resolving entry points and loaders | |
// from configuration. | |
context: __dirname, | |
// Specify entry points of application | |
entry: { | |
'app.bundle': sourceDir + '/bundle/app.js', | |
codemirror: sourceDir + '/bundle/codemirror.js', | |
sqleditor: './pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js', | |
debugger_direct: './pgadmin/tools/debugger/templates/debugger/js/direct.js', | |
file_utils: './pgadmin/misc/file_manager/templates/file_manager/js/utility.js', | |
pgadmin_css: './pgadmin/static/scss/pgadmin.scss', | |
style_css: './pgadmin/static/css/style.css', | |
}, | |
// path: The output directory for generated bundles(defined in entry) | |
// Ref: https://webpack.js.org/configuration/output/#output-library | |
output: { | |
libraryTarget: 'amd', | |
path: __dirname + '/pgadmin/static/js/generated', | |
filename: '[name].js', | |
libraryExport: 'default', | |
}, | |
// Templates files which contains python code needs to load dynamically | |
// Such files specified in externals are loaded at first and defined in | |
// the start of generated bundle within define(['libname'],fn) etc. | |
externals: { | |
'pgadmin.browser.messages': 'pgadmin.browser.messages', | |
'pgadmin.browser.utils': 'pgadmin.browser.utils', | |
'pgadmin.browser.endpoints': 'pgadmin.browser.endpoints', | |
'pgadmin.server.supported_servers': 'pgadmin.server.supported_servers', | |
'pgadmin.user_management.current_user': 'pgadmin.user_management.current_user', | |
'pgadmin.node.unique_key': 'pgadmin.node.unique_key', | |
'translations': 'translations', | |
}, | |
module: { | |
// References: | |
// Module and Rules: https://webpack.js.org/configuration/module/ | |
// Loaders: https://webpack.js.org/loaders/ | |
// | |
// imports-loader: it adds dependent modules(use:imports-loader?module1) | |
// at the beginning of module it is dependency of like: | |
// var jQuery = require('jquery'); var browser = require('pgadmin.browser') | |
// It solves number of problems | |
// Ref: http:/github.com/webpack-contrib/imports-loader/ | |
rules: [{ | |
test: /\.jsx?$/, | |
exclude: [/node_modules/, /vendor/], | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: ['es2015', 'react'], | |
}, | |
}, | |
}, { | |
// Transforms the code in a way that it works in the webpack environment. | |
// It uses imports-loader internally to load dependency. Its | |
// configuration is specified in webpack.shim.js | |
// Ref: https://www.npmjs.com/package/shim-loader | |
test: /\.js/, | |
loader: 'shim-loader', | |
query: webpackShimConfig, | |
include: path.join(__dirname, '/pgadmin/browser'), | |
}, { | |
test: require.resolve('./pgadmin/tools/datagrid/templates/datagrid/js/datagrid'), | |
use: { | |
loader: 'imports-loader?' + | |
'pgadmin.dashboard' + | |
',pgadmin.tools.user_management' + | |
',misc.statistics' + | |
',misc.depends' + | |
',misc.sql' + | |
',misc.bgprocess' + | |
',pgadmin.node.server_group' + | |
',pgadmin.node.server' + | |
',pgadmin.node.database' + | |
',pgadmin.node.role' + | |
',pgadmin.node.cast' + | |
',pgadmin.node.tablespace' + | |
',pgadmin.node.resource_group' + | |
',pgadmin.node.event_trigger' + | |
',pgadmin.node.extension' + | |
',pgadmin.node.language' + | |
',pgadmin.node.foreign_data_wrapper' + | |
',pgadmin.node.schema' + | |
',pgadmin.node.catalog' + | |
',pgadmin.node.catalog_object' + | |
',pgadmin.node.collation' + | |
',pgadmin.node.domain' + | |
',pgadmin.node.domain_constraints' + | |
',pgadmin.node.foreign_table' + | |
',pgadmin.node.fts_configuration' + | |
',pgadmin.node.fts_dictionary' + | |
',pgadmin.node.fts_parser' + | |
',pgadmin.node.fts_template' + | |
',pgadmin.node.function' + | |
',pgadmin.node.procedure' + | |
',pgadmin.node.edbfunc' + | |
',pgadmin.node.edbproc' + | |
',pgadmin.node.edbvar' + | |
',pgadmin.node.edbvar' + | |
',pgadmin.node.trigger_function' + | |
',pgadmin.node.package' + | |
',pgadmin.node.sequence' + | |
',pgadmin.node.synonym' + | |
',pgadmin.node.type' + | |
',pgadmin.node.rule' + | |
',pgadmin.node.index' + | |
',pgadmin.node.trigger' + | |
',pgadmin.node.catalog_object_column' + | |
',pgadmin.node.view' + | |
',pgadmin.node.mview' + | |
',pgadmin.node.table', | |
}, | |
}, { | |
test: require.resolve('./node_modules/acitree/js/jquery.aciTree.min'), | |
use: { | |
loader: 'imports-loader?this=>window', | |
}, | |
}, { | |
test: require.resolve('./node_modules/acitree/js/jquery.aciPlugin.min'), | |
use: { | |
loader: 'imports-loader?this=>window', | |
}, | |
}, { | |
test: require.resolve('./pgadmin/static/bundle/browser'), | |
use: { | |
loader: 'imports-loader?' + | |
'pgadmin.about' + | |
',pgadmin.preferences' + | |
',misc.file_manager' + | |
',pgadmin.settings' + | |
',tools.backup' + | |
',tools.restore' + | |
',tools.grant_wizard' + | |
',tools.maintenance' + | |
',tools.import_export' + | |
',tools.debugger' + | |
',tools.direct', | |
}, | |
}, { | |
test: require.resolve('snapsvg'), | |
use: { | |
loader: 'imports-loader?this=>window,fix=>module.exports=0', | |
}, | |
}, { | |
test: /\.(jpe?g|png|gif|svg)$/i, | |
loaders: [ | |
'file-loader?hash=sha512&digest=hex&name=img/[name].[ext]', { | |
loader: 'image-webpack-loader', | |
query: { | |
bypassOnDebug: true, | |
mozjpeg: { | |
progressive: true, | |
}, | |
gifsicle: { | |
interlaced: false, | |
}, | |
optipng: { | |
optimizationLevel: 7, | |
}, | |
pngquant: { | |
quality: '75-90', | |
speed: 3, | |
}, | |
}, | |
}, | |
], | |
exclude: /vendor/, | |
}, { | |
test: /\.(eot|svg|ttf|woff|woff2)$/, | |
loader: 'file-loader?name=fonts/[name].[ext]', | |
exclude: /vendor/, | |
}, { | |
test: /\.scss$/, | |
use: extractSass.extract({ | |
use: [{ | |
loader: 'css-loader', | |
}, { | |
loader: 'sass-loader', // compiles Sass to CSS | |
options: { | |
includePaths: ['./pgadmin/static/scss/'], | |
}, | |
}], | |
}), | |
}, { | |
test: /\.css$/, | |
use: extractStyle.extract({ | |
use: [{ | |
loader: 'css-loader', | |
}], | |
}), | |
}], | |
// Prevent module from parsing through webpack, helps in reducing build time | |
noParse: [/moment.js/], | |
}, | |
resolve: { | |
alias: webpackShimConfig.resolveAlias, | |
modules: ['node_modules', '.'], | |
extensions: ['.js', '.jsx'], | |
unsafeCache: true, | |
}, | |
// Define list of Plugins used in Production or development mode | |
// Ref:https://webpack.js.org/concepts/plugins/#components/sidebar/sidebar.jsx | |
plugins: PRODUCTION ? [ | |
extractSass, | |
extractStyle, | |
vendorChunks, | |
pgAdminCommonChunks, | |
providePlugin, | |
uglifyPlugin, | |
optimizeAssetsPlugin, | |
definePlugin, | |
hardSourceWebpackPlugin, | |
]: [ | |
extractSass, | |
extractStyle, | |
vendorChunks, | |
pgAdminCommonChunks, | |
providePlugin, | |
hardSourceWebpackPlugin, | |
], | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env node */ | |
//Configuration file contains requireJS like shim and paths used by webpack shim-loader | |
const path = require('path'); | |
var webpackShimConfig = { | |
shim: { | |
'moment': { | |
exports: 'moment', | |
}, | |
'underscore': { | |
exports: '_', | |
}, | |
'jquery': { | |
'exports': '$', | |
}, | |
'bootstrap': { | |
'deps': ['jquery'], | |
}, | |
'select2': { | |
'deps': ['jquery'], | |
'exports': '$.fn.select2', | |
}, | |
'bootstrap.datepicker': { | |
'deps': ['jquery', 'bootstrap'], | |
'exports': 'jQuery.fn.datepicker', | |
}, | |
'bootstrap.datetimepicker': { | |
'exports': 'jQuery.fn.datetimepicker', | |
}, | |
'bootstrap.switch': { | |
deps: ['jquery', 'bootstrap'], | |
'exports': '$.fn.bootstrapSwitch', | |
}, | |
'backbone': { | |
exports: 'Backbone', // Once loaded, use the global 'Backbone' as the module value. | |
deps: [ | |
'underscore', // just make sure that underscore is loaded before (uses it's global value) | |
'jquery:$', // Provide jquery as dependency with name $ | |
], | |
}, | |
'backgrid': { | |
'deps': ['backform'], | |
'exports': 'Backgrid', | |
}, | |
'pgadmin.backform': { | |
'deps': ['backform', 'pgadmin.backgrid', 'select2'], | |
}, | |
'pgadmin.backgrid': { | |
'deps': ['backgrid', 'bootstrap.datetimepicker', 'bootstrap.switch'], | |
}, | |
'backgrid.select.all': { | |
'deps': ['backgrid'], | |
}, | |
'backgrid.paginator': { | |
'deps': ['backgrid', 'backbone.paginator'], | |
}, | |
'backgrid.filter': { | |
'deps': ['backgrid'], | |
}, | |
'backgrid.sizeable.columns': { | |
'deps': ['backgrid'], | |
}, | |
'jquery.event.drag': { | |
'deps': ['jquery'], 'exports': 'jQuery.fn.drag', | |
}, | |
'jquery.ui': {'deps': ['jquery']}, | |
'slick.pgadmin.formatters': { | |
'deps': ['slickgrid'], | |
}, | |
'slick.pgadmin.editors': { | |
'deps': ['slickgrid'], | |
}, | |
'slickgrid': { | |
'deps': ['jquery', 'jquery.ui', 'jquery.event.drag'], | |
'exports': 'Slick', | |
}, | |
'flotr2': { | |
deps: ['bean'], | |
}, | |
'alertify': { | |
'exports': 'alertify', | |
}, | |
'jqueryui.position': { | |
'deps': ['jquery'], | |
'exports': 'jQuery.ui.position', | |
}, | |
'jquery.contextmenu': { | |
'deps': ['jquery', 'jqueryui.position'], | |
'exports': 'jQuery.contextMenu', | |
}, | |
'jquery.aciplugin': { | |
'deps': ['jquery'], | |
'exports': 'aciPluginClass', | |
}, | |
'jquery.acitree': { | |
'deps': ['jquery', 'jquery.aciplugin'], | |
'exports': 'aciPluginClass.plugins.aciTree', | |
}, | |
'jquery.acisortable': { | |
'deps': ['jquery', 'jquery.aciplugin'], | |
'exports': 'aciPluginClass.plugins.aciSortable', | |
}, | |
'jquery.acifragment': { | |
'deps': ['jquery', 'jquery.aciplugin'], | |
'exports': 'aciPluginClass.plugins.aciFragment', | |
}, | |
'wcdocker': { | |
'deps': ['jquery.contextmenu'], | |
}, | |
'pgadmin.browser.messages': { | |
'deps': ['pgadmin.browser.datamodel'], | |
}, | |
}, | |
// Map module id to file path used in 'define(['baseurl', 'misc']). It is | |
// used by webpack while creating bundle | |
resolveAlias: { | |
'baseurl': path.join(__dirname, './pgadmin'), | |
'misc': path.join(__dirname, './pgadmin/static/bundle/misc'), | |
'browser_node': path.join(__dirname, './pgadmin/static/bundle/browser'), | |
'sources': path.join(__dirname, './pgadmin/static/js'), | |
'pgadmin': path.join(__dirname, './pgadmin/static/js/pgadmin'), | |
'tools.translations': path.join(__dirname, './pgadmin/tools/templates/js/translations'), | |
'sources/gettext': path.join(__dirname, './pgadmin/static/js/gettext'), | |
'babel-polyfill': path.join(__dirname, './node_modules/babel-polyfill/dist/polyfill'), | |
// Vendor JS | |
'jquery': path.join(__dirname, './node_modules/jquery/dist/jquery'), | |
'wcdocker': path.join(__dirname, './node_modules/webcabin-docker/Build/wcDocker'), | |
'alertify': path.join(__dirname, './node_modules/alertifyjs/build/alertify'), | |
'moment': path.join(__dirname, './node_modules/moment/moment'), | |
'jquery.event.drag': path.join(__dirname, './node_modules/slickgrid/lib/jquery.event.drag-2.2'), | |
'jquery.ui': path.join(__dirname, './node_modules/slickgrid/lib/jquery-ui-1.11.3'), | |
'flotr2': path.join(__dirname, './node_modules/flotr2/flotr2.amd'), | |
'bean': path.join(__dirname, './node_modules/flotr2/lib/bean'), | |
'jqueryui.position': path.join(__dirname, './node_modules/jquery-contextmenu/dist/jquery.ui.position'), | |
'jquery.contextmenu': path.join(__dirname, './node_modules/jquery-contextmenu/dist/jquery.contextMenu'), | |
'dropzone': path.join(__dirname, './node_modules/dropzone/dist/dropzone'), | |
'bignumber': path.join(__dirname, './node_modules/bignumber.js/bignumber'), | |
// AciTree | |
'jquery.acitree': path.join(__dirname, './node_modules/acitree/js/jquery.aciTree.min'), | |
'jquery.aciplugin': path.join(__dirname, './node_modules/acitree/js/jquery.aciPlugin.min'), | |
'jquery.acisortable': path.join(__dirname, './node_modules/acitree/js/jquery.aciSortable.min'), | |
'jquery.acifragment': path.join(__dirname, './node_modules/acitree/js/jquery.aciFragment.min'), | |
// Backbone and Backgrid | |
'backbone': path.join(__dirname, './node_modules/backbone/backbone'), | |
'backbone.undo': path.join(__dirname, './node_modules/backbone-undo/Backbone.Undo'), | |
'backform': path.join(__dirname, './node_modules/backform/src/backform'), | |
'backgrid': path.join(__dirname, './node_modules/backgrid/lib/backgrid'), | |
'bootstrap.datetimepicker': path.join(__dirname, './node_modules/bootstrap-datetime-picker/js/bootstrap-datetimepicker'), | |
'bootstrap.switch': path.join(__dirname, './node_modules/bootstrap-switch/dist/js/bootstrap-switch'), | |
'select2': path.join(__dirname, './node_modules/select2/dist/js/select2.full'), | |
'backgrid.filter': path.join(__dirname, './node_modules/backgrid-filter/backgrid-filter'), | |
'backgrid.sizeable.columns': path.join(__dirname, './node_modules/backgrid-sizeable-columns/backgrid-sizeable-columns'), | |
'backgrid.select.all': path.join(__dirname, './node_modules/backgrid-select-all/backgrid-select-all'), | |
'pgadmin.alertifyjs': path.join(__dirname, './pgadmin/static/js/alertify.pgadmin.defaults'), | |
'pgadmin.backform': path.join(__dirname, './pgadmin/static/js/backform.pgadmin'), | |
'pgadmin.backgrid': path.join(__dirname, './pgadmin/static/js/backgrid.pgadmin'), | |
'pgadmin.misc.explain': path.join(__dirname, './pgadmin/misc/templates/explain/js/explain'), | |
'pgadmin.settings': path.join(__dirname, './pgadmin/settings/templates/settings/settings'), | |
'pgadmin.preferences': path.join(__dirname, './pgadmin/preferences/templates/preferences/preferences'), | |
'pgadmin.dashboard': path.join(__dirname, './pgadmin/dashboard/templates/dashboard/js/dashboard'), | |
'bundled_codemirror': path.join(__dirname, './pgadmin/static/bundle/codemirror'), | |
'pgadmin.sqlfoldcode': path.join(__dirname, './pgadmin/static/js/codemirror/addon/fold/pgadmin-sqlfoldcode'), | |
'pgadmin.about': path.join(__dirname, './pgadmin/about/templates/about/about'), | |
//tools JS | |
'tools.backup': path.join(__dirname, './pgadmin/tools/backup/templates/backup/js/backup'), | |
'tools.restore': path.join(__dirname, './pgadmin/tools/restore/templates/restore/js/restore'), | |
'pgadmin.browser.wizard': path.join(__dirname, './pgadmin/browser/static/js/wizard'), | |
'tools.grant_wizard': path.join(__dirname, './pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard'), | |
'tools.datagrid': path.join(__dirname, './pgadmin/tools/datagrid/templates/datagrid/js/datagrid'), | |
'tools.querytool': path.join(__dirname, './pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor'), | |
'tools.maintenance': path.join(__dirname, './pgadmin/tools/maintenance/templates/maintenance/js/maintenance'), | |
'tools.import_export': path.join(__dirname, './pgadmin/tools/import_export/templates/import_export/js/import_export'), | |
'tools.debugger.ui': path.join(__dirname, './pgadmin/tools/debugger/templates/debugger/js/debugger_ui'), | |
'tools.debugger': path.join(__dirname, './pgadmin/tools/debugger/templates/debugger/js/debugger'), | |
'tools.direct': path.join(__dirname, './pgadmin/tools/debugger/templates/debugger/js/direct'), | |
// Misc JS | |
'misc.bgprocess': path.join(__dirname, './pgadmin/misc/bgprocess/static/js/bgprocess'), | |
'misc.file_manager': path.join(__dirname, './pgadmin/misc/file_manager/templates/file_manager/js/file_manager'), | |
'misc.file_utility': path.join(__dirname, './pgadmin/misc/file_manager/templates/file_manager/js/utility'), | |
'misc.statistics': path.join(__dirname, './pgadmin/misc/statistics/static/js/statistics'), | |
'misc.depends': path.join(__dirname, './pgadmin/misc/depends/static/js/depends'), | |
'misc.sql': path.join(__dirname, './pgadmin/misc/sql/static/js/sql'), | |
// Browser Plugins JS | |
'pgadmin.browser': path.join(__dirname, './pgadmin/browser/templates/browser/js/browser'), | |
'pgadmin.browser.error': path.join(__dirname, './pgadmin/browser/templates/browser/js/error'), | |
'pgadmin.browser.utils': path.join(__dirname, './pgadmin/browser/templates/browser/js/utils'), | |
'pgadmin.browser.server.privilege': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/privilege'), | |
'pgadmin.browser.server.variable': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/variable'), | |
'pgadmin.browser.collection': path.join(__dirname, './pgadmin/browser/templates/browser/js/collection'), | |
'pgadmin.browser.node': path.join(__dirname, './pgadmin/browser/templates/browser/js/node'), | |
'pgadmin.browser.node.ui': path.join(__dirname, './pgadmin/browser/static/js/node.ui'), | |
'pgadmin.browser.datamodel': path.join(__dirname, './pgadmin/browser/static/js/datamodel'), | |
'pgadmin.browser.menu': path.join(__dirname, './pgadmin/browser/static/js/menu'), | |
'pgadmin.browser.panel': path.join(__dirname, './pgadmin/browser/static/js/panel'), | |
'pgadmin.browser.frame': path.join(__dirname, './pgadmin/browser/static/js/frame'), | |
'pgadmin.tools.user_management': path.join(__dirname, './pgadmin/tools/user_management/templates/user_management/js/user_management'), | |
'slick.pgadmin.editors': path.join(__dirname, './pgadmin/static/js/slickgrid/slick.pgadmin.editors'), | |
'slick.pgadmin.formatters': path.join(__dirname, './pgadmin/static/js/slickgrid/slick.pgadmin.formatters'), | |
// Browser Nodes JS | |
'pgadmin.node.server_group': path.join(__dirname, './pgadmin/browser/server_groups/static/js/server-group'), | |
'pgadmin.node.server': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/server'), | |
'pgadmin.node.database': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/static/js/database'), | |
'pgadmin.node.role': path.join(__dirname, './pgadmin/browser/server_groups/servers/roles/templates/role/js/role'), | |
'pgadmin.node.tablespace': path.join(__dirname, './pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces'), | |
'pgadmin.node.resource_group': path.join(__dirname, './pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/js/resource_groups'), | |
'pgadmin.node.cast': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/casts/static/js/cast'), | |
'pgadmin.node.event_trigger': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger'), | |
'pgadmin.node.extension': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension'), | |
'pgadmin.node.foreign_data_wrapper': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper'), | |
'pgadmin.node.language': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/languages/static/js/language'), | |
'pgadmin.node.schema': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema'), | |
'pgadmin.node.catalog': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog'), | |
'pgadmin.node.catalog_object': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/static/js/catalog_object'), | |
'pgadmin.node.collation': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation'), | |
'pgadmin.node.domain': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain'), | |
'pgadmin.node.domain_constraints': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints'), | |
'pgadmin.node.foreign_table': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign-table'), | |
'pgadmin.node.fts_configuration': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration'), | |
'pgadmin.node.fts_dictionary': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary'), | |
'pgadmin.node.fts_parser': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/static/js/fts_parser'), | |
'pgadmin.node.fts_template': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template'), | |
'pgadmin.node.function': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function'), | |
'pgadmin.node.procedure': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/procedure'), | |
'pgadmin.node.trigger_function': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function'), | |
'pgadmin.node.package': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package'), | |
'pgadmin.node.sequence': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence'), | |
'pgadmin.node.synonym': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym'), | |
'pgadmin.node.table': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table'), | |
'pgadmin.browser.table.partition.utils': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/partition.utils'), | |
'pgadmin.node.type': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type'), | |
'pgadmin.node.view': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/view'), | |
'pgadmin.node.mview': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview'), | |
'pgadmin.node.rule': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/templates/rules/js/rules'), | |
'pgadmin.node.index': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index'), | |
'pgadmin.node.trigger': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger'), | |
'pgadmin.node.column': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column'), | |
'pgadmin.node.constraints': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/templates/constraints/js/constraints'), | |
'pgadmin.node.check_constraints': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint'), | |
'pgadmin.node.exclusion_constraint': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint'), | |
'pgadmin.node.foreign_key': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key'), | |
'pgadmin.node.primary_key': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key'), | |
'pgadmin.node.unique_constraint': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint'), | |
'pgadmin.node.catalog_object_column': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/templates/catalog_object_column/js/catalog_object_column'), | |
'pgadmin.node.edbfunc': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbfunc/js/edbfunc'), | |
'pgadmin.node.edbproc': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbproc/js/edbproc'), | |
'pgadmin.node.edbvar': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/templates/edbvar/js/edbvar'), | |
// pgAgent jobs JS | |
'pgadmin.node.pga_job': path.join(__dirname, './pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job'), | |
'pgadmin.node.pga_schedule': path.join(__dirname, './pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule'), | |
'pgadmin.node.pga_jobstep': path.join(__dirname, './pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep'), | |
}, | |
// Define list of pgAdmin common libraries to bundle them separately | |
// into commons JS from app.bundle.js | |
pgLibs: [ | |
'pgadmin.browser.wizard', 'pgadmin.browser.error', 'pgadmin.browser.server.privilege', | |
'pgadmin.browser.server.variable', 'pgadmin.browser.collection', 'pgadmin.browser.node.ui', | |
'pgadmin.browser.datamodel', 'pgadmin.browser.menu', 'pgadmin.browser.panel', 'pgadmin', | |
'pgadmin.browser.frame', 'slick.pgadmin.editors', 'slick.pgadmin.formatters', | |
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser', 'misc.file_manager', | |
'misc.file_utility', 'sources/alerts/alertify_wrapper', 'pgadmin.browser.node', | |
'pgadmin.alertifyjs', 'pgadmin.settings', 'pgadmin.preferences', 'pgadmin.sqlfoldcode', | |
], | |
// Checks whether JS module is npm module or not | |
isExternal: function(module) { | |
var context = module.context; | |
if (typeof context !== 'string') { return false; } | |
return context.indexOf('node_modules') !== -1; | |
}, | |
// Checks whether module is in pgLibs or not. Returns true if exists | |
isPgAdminLib: function (module) { | |
if (module.rawRequest === undefined) { return false; } | |
return this.pgLibs.indexOf(module.rawRequest) !== -1; | |
}, | |
}; | |
module.exports = webpackShimConfig; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment