aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/config
diff options
context:
space:
mode:
authorStas Vilchik <stas-vilchik@users.noreply.github.com>2017-03-27 12:04:48 +0200
committerGitHub <noreply@github.com>2017-03-27 12:04:48 +0200
commit7d963d84f40ee3db3b51c557fb596aa9febf82bb (patch)
tree7f761f198fae4ad898f4dd98703923921520098b /server/sonar-web/config
parent48699b502c866ea5a309c57f8ad5e737d1933280 (diff)
downloadsonarqube-7d963d84f40ee3db3b51c557fb596aa9febf82bb.tar.gz
sonarqube-7d963d84f40ee3db3b51c557fb596aa9febf82bb.zip
optimize js bundles (#1855)
Diffstat (limited to 'server/sonar-web/config')
-rw-r--r--server/sonar-web/config/webpack/webpack.config.base.js26
-rw-r--r--server/sonar-web/config/webpack/webpack.config.dev.js4
2 files changed, 19 insertions, 11 deletions
diff --git a/server/sonar-web/config/webpack/webpack.config.base.js b/server/sonar-web/config/webpack/webpack.config.base.js
index f6551d344d7..fe00c755bed 100644
--- a/server/sonar-web/config/webpack/webpack.config.base.js
+++ b/server/sonar-web/config/webpack/webpack.config.base.js
@@ -7,25 +7,36 @@ var autoprefixerOptions = require('../autoprefixer');
module.exports = {
entry: {
- 'vendor': [
+ vendor: [
require.resolve('../polyfills'),
'jquery',
'underscore',
- 'd3',
+ 'lodash',
+ 'd3-array',
+ 'd3-hierarchy',
+ 'd3-scale',
+ 'd3-selection',
+ 'd3-shape',
'react',
'react-dom',
'backbone',
'backbone.marionette',
'moment',
- 'handlebars/runtime'
+ 'handlebars/runtime',
+ './src/main/js/libs/third-party/jquery-ui.js',
+ './src/main/js/libs/third-party/select2.js',
+ './src/main/js/libs/third-party/keymaster.js',
+ './src/main/js/libs/third-party/bootstrap/tooltip.js',
+ './src/main/js/libs/third-party/bootstrap/dropdown.js'
],
- 'app': './src/main/js/app/index.js'
+ app: ['./src/main/js/app/index.js', './src/main/js/components/SourceViewer/SourceViewer.js']
},
output: {
path: paths.appBuild,
+ publicPath: '/',
filename: 'js/[name].[chunkhash:8].js',
- chunkFilename: 'js/[name].[chunkhash:8].chunk.js',
+ chunkFilename: 'js/[name].[chunkhash:8].chunk.js'
},
resolve: {
// This allows you to set a fallback for where Webpack should look for modules.
@@ -49,7 +60,7 @@ module.exports = {
{
test: /\.js$/,
loader: 'babel',
- exclude: /(node_modules|libs)/,
+ exclude: /(node_modules|libs)/
},
{
test: /(blueimp-md5|numeral)/,
@@ -74,12 +85,11 @@ module.exports = {
{ test: require.resolve('underscore'), loader: 'expose?_' },
{ test: require.resolve('backbone'), loader: 'expose?Backbone' },
{ test: require.resolve('backbone.marionette'), loader: 'expose?Marionette' },
- { test: require.resolve('d3'), loader: 'expose?d3' },
{ test: require.resolve('react'), loader: 'expose?React' },
{ test: require.resolve('react-dom'), loader: 'expose?ReactDOM' }
]
},
- postcss: function () {
+ postcss: function() {
return [autoprefixer(autoprefixerOptions)];
},
// Some libraries import Node modules but don't use them in the browser.
diff --git a/server/sonar-web/config/webpack/webpack.config.dev.js b/server/sonar-web/config/webpack/webpack.config.dev.js
index fde4c94ca9f..6f4f4da2fac 100644
--- a/server/sonar-web/config/webpack/webpack.config.dev.js
+++ b/server/sonar-web/config/webpack/webpack.config.dev.js
@@ -27,7 +27,6 @@ var paths = require('../paths');
var config = require('./webpack.config.base');
var getClientEnvironment = require('../env');
-var publicPath = '';
var webContext = '';
var env = getClientEnvironment();
@@ -53,7 +52,6 @@ config.entry.vendor.unshift(require.resolve('react-dev-utils/webpackHotDevClient
config.output.pathinfo = true;
// This is the URL that app is served from.
-config.output.publicPath = publicPath;
config.output.filename = 'js/[name].js';
config.output.chunkFilename = 'js/[name].chunk.js';
@@ -72,7 +70,7 @@ config.plugins = [
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
inject: false,
- template: paths.appHtml,
+ template: paths.appHtml
}),
// Makes some environment variables available to the JS code, for example: