Skip to content

Commit

Permalink
HUE-9425 [ui] Fix issue with the CleanWebpackPlugin trying to clean t…
Browse files Browse the repository at this point in the history
…he wrong folder

It needs to be declared in the root build folder.
  • Loading branch information
JohanAhlen committed Aug 4, 2020
1 parent d91655b commit fdf029b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 0 additions & 4 deletions desktop/core/src/desktop/js/webpack/configUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const CleanObsoleteChunks = require('webpack-clean-obsolete-chunks');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const RelativeBundleTracker = require('./relativeBundleTracker');
const RemoveVueAbsolutePathFromMapPlugin = require('./removeVueAbsolutePathFromMapPlugin');
const webpack = require('webpack');
Expand All @@ -36,9 +35,6 @@ const getPluginConfig = (name, withAnalyzer) => {
publicPath: `/static/desktop/js/bundles/${name}/`,
fileContext: 'public'
}),
new CleanWebpackPlugin([
`${__dirname}/desktop/core/src/desktop/static/desktop/js/bundles/${name}`
]),
new RelativeBundleTracker({
path: '.',
filename: `webpack-stats${name !== BUNDLES.HUE ? '-' + name : ''}.json`
Expand Down
5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const CleanWebpackPlugin = require('clean-webpack-plugin');
const {
BUNDLES,
getPluginConfig,
Expand Down Expand Up @@ -79,7 +80,9 @@ module.exports = {
maxEntrypointSize: 400 * 1024, // 400kb
maxAssetSize: 400 * 1024 // 400kb
},
plugins: getPluginConfig(BUNDLES.HUE),
plugins: getPluginConfig(BUNDLES.HUE).concat([
new CleanWebpackPlugin([`${__dirname}/desktop/core/src/desktop/static/desktop/js/bundles/hue`])
]),
resolve: {
extensions: ['.json', '.jsx', '.js', '.tsx', '.ts', '.vue'],
modules: ['node_modules', 'js'],
Expand Down
7 changes: 6 additions & 1 deletion webpack.config.login.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const CleanWebpackPlugin = require('clean-webpack-plugin');
const {
BUNDLES,
getPluginConfig,
Expand All @@ -39,6 +40,10 @@ module.exports = {
path: __dirname + '/desktop/core/src/desktop/static/desktop/js/bundles/login',
filename: shared.output.filename
},
plugins: getPluginConfig(BUNDLES.LOGIN),
plugins: getPluginConfig(BUNDLES.LOGIN).concat([
new CleanWebpackPlugin([
`${__dirname}/desktop/core/src/desktop/static/desktop/js/bundles/login`
])
]),
resolve: shared.resolve
};
7 changes: 6 additions & 1 deletion webpack.config.workers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const CleanWebpackPlugin = require('clean-webpack-plugin');
const {
BUNDLES,
getPluginConfig,
Expand Down Expand Up @@ -44,5 +45,9 @@ module.exports = {
globalObject: 'this'
},
module: shared.module,
plugins: getPluginConfig(BUNDLES.WORKERS)
plugins: getPluginConfig(BUNDLES.WORKERS).concat([
new CleanWebpackPlugin([
`${__dirname}/desktop/core/src/desktop/static/desktop/js/bundles/workers`
])
])
};

0 comments on commit fdf029b

Please sign in to comment.