|
@@ -1,33 +1,26 @@
|
|
|
-var fs = require('fs');
|
|
|
|
|
var webpack = require('webpack');
|
|
var webpack = require('webpack');
|
|
|
var BundleTracker = require('webpack-bundle-tracker');
|
|
var BundleTracker = require('webpack-bundle-tracker');
|
|
|
-var path = require('path');
|
|
|
|
|
|
|
+var WebpackShellPlugin = require('webpack-shell-plugin');
|
|
|
|
|
|
|
|
-var jqueryShim = new webpack.ProvidePlugin({
|
|
|
|
|
|
|
+new webpack.ProvidePlugin({
|
|
|
$: 'jquery',
|
|
$: 'jquery',
|
|
|
jQuery: 'jquery',
|
|
jQuery: 'jquery',
|
|
|
'window.jQuery': 'jquery'
|
|
'window.jQuery': 'jquery'
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-// Note that since we are using 'npm install' and stopped using --legacy-bundling,
|
|
|
|
|
-// we are not ensured which version is installed and where. We will try cloudera-ui
|
|
|
|
|
-// first, and if it is not there we will let 'require' resolve it. The latter means
|
|
|
|
|
-// that a version compatible with cloudera-ui and other libraries was installed at the
|
|
|
|
|
-// top of the node_modules directory.
|
|
|
|
|
-var lodashDir = path.resolve('node_modules/lodash');
|
|
|
|
|
-if (!fs.exists(lodashDir)) {
|
|
|
|
|
- lodashDir = require.resolve('lodash');
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
module.exports = {
|
|
module.exports = {
|
|
|
devtool: 'source-map',
|
|
devtool: 'source-map',
|
|
|
- progress: true,
|
|
|
|
|
- host: '0.0.0.0',
|
|
|
|
|
- port: '8080',
|
|
|
|
|
|
|
+ mode: 'development',
|
|
|
|
|
+ optimization: {
|
|
|
|
|
+ minimize: true
|
|
|
|
|
+ },
|
|
|
|
|
+ performance: {
|
|
|
|
|
+ maxEntrypointSize: 400 * 1024, // 400kb
|
|
|
|
|
+ maxAssetSize: 400 * 1024 // 400kb
|
|
|
|
|
+ },
|
|
|
resolve: {
|
|
resolve: {
|
|
|
- extensions: ['', '.json', '.jsx', '.js'],
|
|
|
|
|
-
|
|
|
|
|
- modulesDirectories: [
|
|
|
|
|
|
|
+ extensions: ['.json', '.jsx', '.js'],
|
|
|
|
|
+ modules: [
|
|
|
'node_modules',
|
|
'node_modules',
|
|
|
'js',
|
|
'js',
|
|
|
'desktop/core/src/desktop/static/desktop/js/cui'
|
|
'desktop/core/src/desktop/static/desktop/js/cui'
|
|
@@ -46,11 +39,11 @@ module.exports = {
|
|
|
hue: ['./desktop/core/src/desktop/static/desktop/js/hue.js']
|
|
hue: ['./desktop/core/src/desktop/static/desktop/js/hue.js']
|
|
|
},
|
|
},
|
|
|
output: {
|
|
output: {
|
|
|
- path: './desktop/core/src/desktop/static/desktop/js',
|
|
|
|
|
|
|
+ path: __dirname + '/desktop/core/src/desktop/static/desktop/js',
|
|
|
filename: 'hue-bundle-[hash].js'
|
|
filename: 'hue-bundle-[hash].js'
|
|
|
},
|
|
},
|
|
|
module: {
|
|
module: {
|
|
|
- loaders: [
|
|
|
|
|
|
|
+ rules: [
|
|
|
{ test: /\.(html)$/, loader: 'html?interpolate&removeComments=false' },
|
|
{ test: /\.(html)$/, loader: 'html?interpolate&removeComments=false' },
|
|
|
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
|
|
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
|
|
|
{ test: /\.css$/, loader: 'style-loader!css-loader' },
|
|
{ test: /\.css$/, loader: 'style-loader!css-loader' },
|
|
@@ -65,8 +58,8 @@ module.exports = {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// expose lodash and jquery for knockout templates to access
|
|
// expose lodash and jquery for knockout templates to access
|
|
|
- { test: /lodash$/, loader: 'expose?_' },
|
|
|
|
|
- { test: /jquery/, loader: 'expose?$!expose?jQuery' },
|
|
|
|
|
|
|
+ { test: /lodash$/, loader: 'expose-loader?_' },
|
|
|
|
|
+ { test: /jquery/, loader: 'expose-loader?$!expose-loader?jQuery' },
|
|
|
|
|
|
|
|
// needed for moment-timezone
|
|
// needed for moment-timezone
|
|
|
{ include: /\.json$/, loaders: ['json-loader'] }
|
|
{ include: /\.json$/, loaders: ['json-loader'] }
|
|
@@ -74,8 +67,8 @@ module.exports = {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
plugins: [
|
|
|
- new BundleTracker({filename: './webpack-stats.json'}),
|
|
|
|
|
- new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }),
|
|
|
|
|
|
|
+ new WebpackShellPlugin({ onBuildStart:[__dirname + '/tools/scripts/clean_js_bundles.sh ' + __dirname ] }),
|
|
|
|
|
+ new BundleTracker({ filename: './webpack-stats.json' }),
|
|
|
new webpack.BannerPlugin('\nLicensed to Cloudera, Inc. under one\nor more contributor license agreements. See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership. Cloudera, Inc. licenses this file\nto you under the Apache License, Version 2.0 (the\n"License"); you may not use this file except in compliance\nwith the License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n'),
|
|
new webpack.BannerPlugin('\nLicensed to Cloudera, Inc. under one\nor more contributor license agreements. See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership. Cloudera, Inc. licenses this file\nto you under the Apache License, Version 2.0 (the\n"License"); you may not use this file except in compliance\nwith the License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n'),
|
|
|
]
|
|
]
|
|
|
-};
|
|
|
|
|
|
|
+};
|