Skip to content

Commit

Permalink
fix(webpack): clean dist folder before build
Browse files Browse the repository at this point in the history
au build --watch essentially does webpack --watch which doesn't clear the dist directory by itself, resulting in many files over time. This still happens, but it gets emptied before a new au build command is ran
  • Loading branch information
JeroenVinke committed Aug 24, 2017
1 parent 3cfd956 commit 053ad98
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/commands/new/buildsystems/webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module.exports = function(project, options) {
'expose-loader',
'style-loader',
'url-loader',
'del',
'css-loader',
'nps-utils',
'file-loader',
Expand Down
1 change: 1 addition & 0 deletions lib/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"cross-env": "5.0.1",
"css-loader": "0.28.4",
"debounce": "^1.0.2",
"del": "^3.0.0",
"event-stream": "^3.3.3",
"expose-loader": "0.7.3",
"extract-text-webpack-plugin": "3.0.0",
Expand Down
6 changes: 6 additions & 0 deletions lib/resources/tasks/build-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import project from '../aurelia.json';
import {CLIOptions, Configuration} from 'aurelia-cli';
import gulp from 'gulp';
import configureEnvironment from './environment';
import del from 'del';

const buildOptions = new Configuration(project.build.options);
const production = CLIOptions.getEnvironment() === 'prod';
Expand Down Expand Up @@ -35,7 +36,12 @@ function onBuild(err, stats) {
}
}

function clearDist() {
return del([config.output.path]);
}

const build = gulp.series(
clearDist,
configureEnvironment,
buildWebpack
);
Expand Down
6 changes: 6 additions & 0 deletions lib/resources/tasks/build-webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as project from '../aurelia.json';
import {CLIOptions, Configuration} from 'aurelia-cli';
import * as gulp from 'gulp';
import configureEnvironment from './environment';
import * as del from 'del';

const buildOptions = new Configuration(project.build.options);
const production = CLIOptions.getEnvironment() === 'prod';
Expand Down Expand Up @@ -35,7 +36,12 @@ function onBuild(err, stats) {
}
}

function clearDist() {
return del([config.output.path]);
}

const build = gulp.series(
clearDist,
configureEnvironment,
buildWebpack
);
Expand Down

0 comments on commit 053ad98

Please sign in to comment.