2019-01-02 04:24:12 -06:00
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
|
|
|
// Copyright (C) 2013 - 2019, The pgAdmin Development Team
|
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
2017-06-12 10:51:54 -05:00
|
|
|
/* eslint-env node */
|
2017-07-20 06:52:15 -05:00
|
|
|
// Import file, libraries and plugins
|
2017-07-18 09:13:16 -05:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
2018-09-04 05:24:51 -05:00
|
|
|
const fs = require('fs');
|
2017-07-20 06:52:15 -05:00
|
|
|
const sourceDir = __dirname + '/pgadmin/static';
|
|
|
|
// webpack.shim.js contains path references for resolve > alias configuration
|
|
|
|
// and other util function used in CommonsChunksPlugin.
|
2017-07-18 09:13:16 -05:00
|
|
|
const webpackShimConfig = require('./webpack.shim');
|
|
|
|
const PRODUCTION = process.env.NODE_ENV === 'production';
|
|
|
|
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
2019-03-14 10:11:16 -05:00
|
|
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
|
|
const extractStyle = new MiniCssExtractPlugin({
|
2019-01-03 08:43:45 -06:00
|
|
|
filename: '[name].css',
|
|
|
|
allChunks: true,
|
|
|
|
});
|
2019-10-10 01:35:28 -05:00
|
|
|
const WebpackRequireFromPlugin = require('webpack-require-from');
|
|
|
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
|
|
|
Improvement in the look and feel of the whole application
Changed the SCSS/CSS for the below third party libraries to adopt the
new look 'n' feel:
- wcDocker
- Alertify dialogs, and notifications
- AciTree
- Bootstrap Navbar
- Bootstrap Tabs
- Bootstrap Drop-Down menu
- Backgrid
- Select2
Adopated the new the look 'n' feel for the dialogs, wizard, properties,
tab panels, tabs, fieldset, subnode control, spinner control, HTML
table, and other form controls.
- Font is changed to Roboto
- Using SCSS variables to define the look 'n' feel
- Designer background images for the Login, and Forget password pages in
'web' mode
- Improved the look 'n' feel for the key selection in the preferences
dialog
- Table classes consistency changes across the application
- File Open and Save dialog list view changes
Author(s): Aditya Toshniwal & Khushboo Vashi
2018-12-21 05:44:55 -06:00
|
|
|
const envType = PRODUCTION ? 'production': 'development';
|
2019-04-30 07:57:10 -05:00
|
|
|
const devToolVal = PRODUCTION ? false : 'eval';
|
2019-10-10 01:35:28 -05:00
|
|
|
const analyzerMode = process.env.ANALYZE=='true' ? 'static' : 'disabled';
|
2017-07-18 09:13:16 -05:00
|
|
|
|
2017-07-20 06:52:15 -05:00
|
|
|
// Expose libraries in app context so they need not to
|
|
|
|
// require('libname') when used in a module
|
2017-07-18 09:13:16 -05:00
|
|
|
const providePlugin = new webpack.ProvidePlugin({
|
|
|
|
$: 'jquery',
|
|
|
|
jQuery: 'jquery',
|
|
|
|
'window.jQuery': 'jquery',
|
|
|
|
_: 'underscore',
|
|
|
|
Backbone: 'backbone',
|
|
|
|
Backgrid: 'backgrid',
|
|
|
|
pgAdmin: 'pgadmin',
|
2018-10-11 07:23:59 -05:00
|
|
|
'moment': 'moment',
|
|
|
|
'window.moment':'moment',
|
2017-07-18 09:13:16 -05:00
|
|
|
});
|
|
|
|
|
2017-07-20 06:52:15 -05:00
|
|
|
// Optimize CSS Assets by removing comments while bundling
|
2017-07-18 09:13:16 -05:00
|
|
|
const optimizeAssetsPlugin = new OptimizeCssAssetsPlugin({
|
|
|
|
assetNameRegExp: /\.css$/g,
|
|
|
|
cssProcessor: require('cssnano'),
|
2019-10-10 01:35:28 -05:00
|
|
|
cssProcessorOptions: {
|
|
|
|
discardComments: {
|
|
|
|
removeAll: true,
|
|
|
|
},
|
|
|
|
},
|
2017-07-18 09:13:16 -05:00
|
|
|
canPrint: true,
|
|
|
|
});
|
|
|
|
|
2017-08-09 06:00:30 -05:00
|
|
|
// Helps in debugging each single file, it extracts the module files
|
|
|
|
// from bundle so that they are accessible by search in Chrome's sources panel.
|
|
|
|
// Reference: https://webpack.js.org/plugins/source-map-dev-tool-plugin/#components/sidebar/sidebar.jsx
|
|
|
|
const sourceMapDevToolPlugin = new webpack.SourceMapDevToolPlugin({
|
|
|
|
filename: '[name].js.map',
|
2019-10-10 01:35:28 -05:00
|
|
|
exclude: /(vendor|codemirror|slickgrid|pgadmin\.js|style\.js|popper)/,
|
2017-08-09 06:00:30 -05:00
|
|
|
columns: false,
|
|
|
|
});
|
|
|
|
|
2019-10-10 01:35:28 -05:00
|
|
|
// Supress errors while compiling as the getChunkURL method will be available
|
|
|
|
// on runtime. window.getChunkURL is defined in base.html
|
|
|
|
const webpackRequireFrom = new WebpackRequireFromPlugin({
|
|
|
|
methodName: 'getChunkURL',
|
|
|
|
supressErrors: true,
|
|
|
|
});
|
2018-10-10 06:43:26 -05:00
|
|
|
|
2019-10-10 01:35:28 -05:00
|
|
|
// can be enabled using bundle:analyze
|
|
|
|
const bundleAnalyzer = new BundleAnalyzerPlugin({
|
|
|
|
analyzerMode: analyzerMode,
|
|
|
|
reportFilename: 'analyze_report.html',
|
|
|
|
});
|
2018-10-10 06:43:26 -05:00
|
|
|
|
|
|
|
function cssToBeSkiped(curr_path) {
|
|
|
|
/** Skip all templates **/
|
|
|
|
if(curr_path.indexOf('template') > -1) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(let i=0; i< webpackShimConfig.css_bundle_skip.length; i++) {
|
|
|
|
if(path.join(__dirname, webpackShimConfig.css_bundle_skip[i]) === curr_path){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-09-04 05:24:51 -05:00
|
|
|
/* Get all the style files recursively and store in array to
|
2018-10-10 06:43:26 -05:00
|
|
|
* give input to webpack.
|
2018-09-04 05:24:51 -05:00
|
|
|
*/
|
2018-10-10 06:43:26 -05:00
|
|
|
function pushModulesCss(curr_path, pgadminStyles) {
|
|
|
|
/** Skip Directories */
|
|
|
|
if(cssToBeSkiped(curr_path)) {
|
2018-09-04 05:24:51 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fs.readdirSync(curr_path).map(function(curr_file) {
|
2018-10-10 06:43:26 -05:00
|
|
|
/** Skip Files */
|
|
|
|
if(cssToBeSkiped(path.join(curr_path, curr_file))) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-09-04 05:24:51 -05:00
|
|
|
let stats = fs.statSync(path.join(curr_path, curr_file));
|
|
|
|
/* if directory, dig further */
|
|
|
|
if(stats.isDirectory()) {
|
2018-10-10 06:43:26 -05:00
|
|
|
pushModulesCss(path.join(curr_path, curr_file), pgadminStyles);
|
2018-09-04 05:24:51 -05:00
|
|
|
}
|
|
|
|
else if(stats.isFile() && (curr_file.endsWith('.scss') || curr_file.endsWith('.css'))) {
|
|
|
|
pgadminStyles.push(path.join(curr_path, curr_file));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2018-10-10 06:43:26 -05:00
|
|
|
|
|
|
|
let pgadminStyles = [];
|
|
|
|
/* Include what is given in shim config */
|
|
|
|
for(let i=0; i<webpackShimConfig.css_bundle_include.length; i++) {
|
|
|
|
pgadminStyles.push(path.join(__dirname, webpackShimConfig.css_bundle_include[i]));
|
|
|
|
}
|
|
|
|
pushModulesCss(path.join(__dirname,'./pgadmin'), pgadminStyles);
|
2018-09-04 05:24:51 -05:00
|
|
|
|
2017-06-12 10:51:54 -05:00
|
|
|
module.exports = {
|
2019-03-14 10:11:16 -05:00
|
|
|
mode: envType,
|
2019-04-30 07:57:10 -05:00
|
|
|
devtool: devToolVal,
|
2017-07-18 09:13:16 -05:00
|
|
|
stats: { children: false },
|
2017-07-20 06:52:15 -05:00
|
|
|
// The base directory, an absolute path, for resolving entry points and loaders
|
|
|
|
// from configuration.
|
2017-07-18 09:13:16 -05:00
|
|
|
context: __dirname,
|
2017-07-20 06:52:15 -05:00
|
|
|
// Specify entry points of application
|
2017-06-13 03:50:41 -05:00
|
|
|
entry: {
|
2017-07-18 09:13:16 -05:00
|
|
|
'app.bundle': sourceDir + '/bundle/app.js',
|
|
|
|
codemirror: sourceDir + '/bundle/codemirror.js',
|
2019-10-10 01:35:28 -05:00
|
|
|
slickgrid: sourceDir + '/bundle/slickgrid.js',
|
2017-07-27 06:55:07 -05:00
|
|
|
sqleditor: './pgadmin/tools/sqleditor/static/js/sqleditor.js',
|
|
|
|
debugger_direct: './pgadmin/tools/debugger/static/js/direct.js',
|
|
|
|
file_utils: './pgadmin/misc/file_manager/static/js/utility.js',
|
2018-09-04 05:24:51 -05:00
|
|
|
pgadmin: pgadminStyles,
|
|
|
|
style: './pgadmin/static/css/style.css',
|
2017-06-13 03:50:41 -05:00
|
|
|
},
|
2017-07-20 06:52:15 -05:00
|
|
|
// path: The output directory for generated bundles(defined in entry)
|
|
|
|
// Ref: https://webpack.js.org/configuration/output/#output-library
|
2017-06-12 10:51:54 -05:00
|
|
|
output: {
|
|
|
|
libraryTarget: 'amd',
|
|
|
|
path: __dirname + '/pgadmin/static/js/generated',
|
2017-06-13 03:50:41 -05:00
|
|
|
filename: '[name].js',
|
2019-10-10 01:35:28 -05:00
|
|
|
chunkFilename: '[name].chunk.js',
|
2017-07-18 09:13:16 -05:00
|
|
|
libraryExport: 'default',
|
|
|
|
},
|
2017-07-20 06:52:15 -05:00
|
|
|
// 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.
|
2017-07-27 06:55:07 -05:00
|
|
|
externals: webpackShimConfig.externals,
|
2017-06-12 10:51:54 -05:00
|
|
|
module: {
|
2017-07-20 06:52:15 -05:00
|
|
|
// 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/
|
2017-06-12 10:51:54 -05:00
|
|
|
rules: [{
|
2019-03-07 04:51:59 -06:00
|
|
|
test: /\.js$/,
|
2017-06-13 03:50:41 -05:00
|
|
|
exclude: [/node_modules/, /vendor/],
|
2017-06-12 10:51:54 -05:00
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
2019-10-10 01:35:28 -05:00
|
|
|
presets: [['@babel/preset-env', {'modules': 'commonjs', 'useBuiltIns': 'usage', 'corejs': 3}]],
|
2017-06-12 10:51:54 -05:00
|
|
|
},
|
|
|
|
},
|
2018-03-02 10:49:25 -06:00
|
|
|
}, {
|
|
|
|
test: /external_table.*\.js/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
2019-10-10 01:35:28 -05:00
|
|
|
presets: [['@babel/preset-env', {'modules': 'commonjs', 'useBuiltIns': 'usage', 'corejs': 3}]],
|
2018-03-02 10:49:25 -06:00
|
|
|
},
|
|
|
|
},
|
2017-06-23 03:35:56 -05:00
|
|
|
}, {
|
2017-07-20 06:52:15 -05:00
|
|
|
// 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
|
2017-07-18 09:13:16 -05:00
|
|
|
test: /\.js/,
|
2018-03-02 10:49:25 -06:00
|
|
|
exclude: [/external_table/],
|
2017-07-18 09:13:16 -05:00
|
|
|
loader: 'shim-loader',
|
|
|
|
query: webpackShimConfig,
|
|
|
|
include: path.join(__dirname, '/pgadmin/browser'),
|
|
|
|
}, {
|
2017-07-27 06:55:07 -05:00
|
|
|
test: require.resolve('./pgadmin/tools/datagrid/static/js/datagrid'),
|
2017-07-18 09:13:16 -05:00
|
|
|
use: {
|
|
|
|
loader: 'imports-loader?' +
|
|
|
|
'pgadmin.dashboard' +
|
|
|
|
',pgadmin.tools.user_management' +
|
2017-07-27 06:55:07 -05:00
|
|
|
',pgadmin.browser.object_statistics' +
|
2019-02-14 05:15:01 -06:00
|
|
|
',pgadmin.browser.dependencies' +
|
|
|
|
',pgadmin.browser.dependents' +
|
2017-07-27 06:55:07 -05:00
|
|
|
',pgadmin.browser.object_sql' +
|
|
|
|
',pgadmin.browser.bgprocess' +
|
2017-07-18 09:13:16 -05:00
|
|
|
',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' +
|
2017-09-11 02:25:39 -05:00
|
|
|
',pgadmin.node.foreign_server' +
|
|
|
|
',pgadmin.node.user_mapping' +
|
2017-07-18 09:13:16 -05:00
|
|
|
',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' +
|
2017-07-31 07:54:14 -05:00
|
|
|
',pgadmin.node.table' +
|
2019-08-08 06:18:46 -05:00
|
|
|
',pgadmin.node.partition' +
|
|
|
|
',pgadmin.node.compound_trigger',
|
2017-07-18 09:13:16 -05:00
|
|
|
},
|
|
|
|
}, {
|
|
|
|
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' +
|
2017-07-27 06:55:07 -05:00
|
|
|
',pgadmin.file_manager' +
|
2017-07-18 09:13:16 -05:00
|
|
|
',pgadmin.settings' +
|
2017-07-27 06:55:07 -05:00
|
|
|
',pgadmin.tools.backup' +
|
|
|
|
',pgadmin.tools.restore' +
|
|
|
|
',pgadmin.tools.grant_wizard' +
|
|
|
|
',pgadmin.tools.maintenance' +
|
|
|
|
',pgadmin.tools.import_export' +
|
|
|
|
',pgadmin.tools.debugger.controller' +
|
2017-08-04 07:09:05 -05:00
|
|
|
',pgadmin.tools.debugger.direct' +
|
|
|
|
',pgadmin.node.pga_job',
|
2017-07-18 09:13:16 -05:00
|
|
|
},
|
|
|
|
}, {
|
|
|
|
test: require.resolve('snapsvg'),
|
|
|
|
use: {
|
|
|
|
loader: 'imports-loader?this=>window,fix=>module.exports=0',
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
test: /\.(jpe?g|png|gif|svg)$/i,
|
2018-09-04 05:24:51 -05:00
|
|
|
loaders: [{
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
emitFile: true,
|
|
|
|
name: 'img/[name].[ext]',
|
|
|
|
limit: 4096,
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
loader: 'image-webpack-loader',
|
|
|
|
query: {
|
|
|
|
bypassOnDebug: true,
|
|
|
|
mozjpeg: {
|
|
|
|
progressive: true,
|
|
|
|
},
|
|
|
|
gifsicle: {
|
|
|
|
interlaced: false,
|
|
|
|
},
|
|
|
|
optipng: {
|
|
|
|
optimizationLevel: 7,
|
|
|
|
},
|
|
|
|
pngquant: {
|
|
|
|
quality: '75-90',
|
|
|
|
speed: 3,
|
2017-07-18 09:13:16 -05:00
|
|
|
},
|
|
|
|
},
|
2018-09-04 05:24:51 -05:00
|
|
|
}],
|
2017-07-18 09:13:16 -05:00
|
|
|
exclude: /vendor/,
|
|
|
|
}, {
|
|
|
|
test: /\.(eot|svg|ttf|woff|woff2)$/,
|
2018-09-04 05:24:51 -05:00
|
|
|
loaders: [{
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: 'fonts/[name].[ext]',
|
|
|
|
emitFile: true,
|
|
|
|
},
|
|
|
|
}],
|
2018-01-12 08:34:39 -06:00
|
|
|
include: [
|
|
|
|
/node_modules/,
|
|
|
|
path.join(sourceDir, '/css/'),
|
|
|
|
path.join(sourceDir, '/scss/'),
|
|
|
|
path.join(sourceDir, '/fonts/'),
|
|
|
|
],
|
2017-07-18 09:13:16 -05:00
|
|
|
exclude: /vendor/,
|
2017-06-30 04:15:44 -05:00
|
|
|
}, {
|
|
|
|
test: /\.scss$/,
|
2019-03-14 10:11:16 -05:00
|
|
|
use: [
|
|
|
|
{loader: MiniCssExtractPlugin.loader},
|
|
|
|
{loader: 'css-loader'},
|
|
|
|
{loader: 'sass-loader'},
|
|
|
|
{
|
2018-09-04 05:24:51 -05:00
|
|
|
loader: 'sass-resources-loader',
|
2017-07-18 09:13:16 -05:00
|
|
|
options: {
|
2018-09-04 05:24:51 -05:00
|
|
|
resources: [
|
|
|
|
'./pgadmin/static/scss/resources/pgadmin.resources.scss',
|
|
|
|
],
|
2017-07-18 09:13:16 -05:00
|
|
|
},
|
2019-03-14 10:11:16 -05:00
|
|
|
},
|
|
|
|
],
|
2017-07-18 09:13:16 -05:00
|
|
|
}, {
|
|
|
|
test: /\.css$/,
|
2019-03-14 10:11:16 -05:00
|
|
|
use: [
|
|
|
|
MiniCssExtractPlugin.loader,
|
|
|
|
'css-loader',
|
|
|
|
],
|
2017-06-23 03:35:56 -05:00
|
|
|
}],
|
2017-07-20 06:52:15 -05:00
|
|
|
// Prevent module from parsing through webpack, helps in reducing build time
|
2017-07-18 09:13:16 -05:00
|
|
|
noParse: [/moment.js/],
|
2017-06-12 10:51:54 -05:00
|
|
|
},
|
|
|
|
resolve: {
|
2017-07-18 09:13:16 -05:00
|
|
|
alias: webpackShimConfig.resolveAlias,
|
|
|
|
modules: ['node_modules', '.'],
|
2019-03-07 04:51:59 -06:00
|
|
|
extensions: ['.js'],
|
2017-07-18 09:13:16 -05:00
|
|
|
unsafeCache: true,
|
2017-06-12 10:51:54 -05:00
|
|
|
},
|
2017-08-25 06:54:46 -05:00
|
|
|
// Watch mode Configuration: After initial build, webpack will watch for
|
|
|
|
// changes in files and compiles only files which are changed,
|
|
|
|
// if watch is set to True
|
|
|
|
// Reference: https://webpack.js.org/configuration/watch/#components/sidebar/sidebar.jsx
|
|
|
|
watchOptions: {
|
|
|
|
aggregateTimeout: 300,
|
|
|
|
poll: 1000,
|
|
|
|
ignored: /node_modules/,
|
|
|
|
},
|
2019-03-14 10:11:16 -05:00
|
|
|
// Webpack 4: uglifyPlugin moved from plugins to optimization
|
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
|
|
|
new UglifyJsPlugin({
|
|
|
|
parallel: true,
|
|
|
|
cache: true,
|
|
|
|
uglifyOptions: {
|
2019-10-10 01:35:28 -05:00
|
|
|
compress: true,
|
|
|
|
extractComments: true,
|
|
|
|
output: {
|
|
|
|
comments: false,
|
|
|
|
},
|
2019-03-14 10:11:16 -05:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
2019-10-10 01:35:28 -05:00
|
|
|
slickgrid: {
|
|
|
|
name: 'slickgrid',
|
|
|
|
filename: 'slickgrid.js',
|
2019-03-14 10:11:16 -05:00
|
|
|
chunks: 'all',
|
|
|
|
reuseExistingChunk: true,
|
2019-10-10 01:35:28 -05:00
|
|
|
priority: 9,
|
|
|
|
minChunks: 2,
|
|
|
|
enforce: true,
|
|
|
|
test(module) {
|
|
|
|
return webpackShimConfig.matchModules(module, 'slickgrid');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
codemirror: {
|
|
|
|
name: 'codemirror',
|
|
|
|
filename: 'codemirror.js',
|
|
|
|
chunks: 'all',
|
|
|
|
reuseExistingChunk: true,
|
|
|
|
priority: 8,
|
|
|
|
minChunks: 2,
|
|
|
|
enforce: true,
|
|
|
|
test(module) {
|
|
|
|
return webpackShimConfig.matchModules(module, 'codemirror');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
vendor_main: {
|
|
|
|
name: 'vendor_main',
|
|
|
|
filename: 'vendor.main.js',
|
|
|
|
chunks: 'all',
|
|
|
|
reuseExistingChunk: true,
|
|
|
|
priority: 7,
|
|
|
|
minChunks: 2,
|
|
|
|
enforce: true,
|
|
|
|
test(module) {
|
|
|
|
return webpackShimConfig.matchModules(module, ['wcdocker', 'backbone', 'jquery', 'bootstrap', 'popper']);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
vendor_others: {
|
|
|
|
name: 'vendor_others',
|
|
|
|
filename: 'vendor.others.js',
|
|
|
|
chunks: 'all',
|
|
|
|
reuseExistingChunk: true,
|
|
|
|
priority: 6,
|
2019-03-14 10:11:16 -05:00
|
|
|
minChunks: 2,
|
|
|
|
enforce: true,
|
|
|
|
test(module) {
|
|
|
|
return webpackShimConfig.isExternal(module);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
secondary: {
|
|
|
|
name: 'pgadmin_commons',
|
|
|
|
filename: 'pgadmin_commons.js',
|
|
|
|
chunks: 'all',
|
2019-10-10 01:35:28 -05:00
|
|
|
priority: 5,
|
2019-03-14 10:11:16 -05:00
|
|
|
minChunks: 2,
|
|
|
|
enforce: true,
|
|
|
|
test(module) {
|
|
|
|
return webpackShimConfig.isPgAdminLib(module);
|
|
|
|
},
|
|
|
|
},
|
2019-10-10 01:35:28 -05:00
|
|
|
browser_nodes: {
|
|
|
|
name: 'browser_nodes',
|
|
|
|
filename: 'browser_nodes.js',
|
|
|
|
chunks: 'all',
|
|
|
|
priority: 4,
|
|
|
|
minChunks: 2,
|
|
|
|
enforce: true,
|
|
|
|
test(module) {
|
|
|
|
return webpackShimConfig.isBrowserNode(module);
|
|
|
|
},
|
|
|
|
},
|
2019-03-14 10:11:16 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2017-07-20 06:52:15 -05:00
|
|
|
// Define list of Plugins used in Production or development mode
|
|
|
|
// Ref:https://webpack.js.org/concepts/plugins/#components/sidebar/sidebar.jsx
|
2017-07-18 09:13:16 -05:00
|
|
|
plugins: PRODUCTION ? [
|
2017-07-20 06:52:15 -05:00
|
|
|
extractStyle,
|
2017-07-18 09:13:16 -05:00
|
|
|
providePlugin,
|
|
|
|
optimizeAssetsPlugin,
|
2017-09-13 03:47:01 -05:00
|
|
|
sourceMapDevToolPlugin,
|
2019-10-10 01:35:28 -05:00
|
|
|
webpackRequireFrom,
|
|
|
|
bundleAnalyzer,
|
2017-07-18 09:13:16 -05:00
|
|
|
]: [
|
2017-07-20 06:52:15 -05:00
|
|
|
extractStyle,
|
2017-07-18 09:13:16 -05:00
|
|
|
providePlugin,
|
2017-08-09 06:00:30 -05:00
|
|
|
sourceMapDevToolPlugin,
|
2019-10-10 01:35:28 -05:00
|
|
|
webpackRequireFrom,
|
2017-07-18 09:13:16 -05:00
|
|
|
],
|
|
|
|
};
|