Skip to content

Commit

Permalink
fix: Read raw config in tasks to avoid circular dependency
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Grunt templates will not be evaluated in Plugins anymore. Use lazy config loading instead.
  • Loading branch information
danez committed Feb 14, 2019
1 parent 11b9b9a commit 570f378
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions tasks/webpack-dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ npm install --save-dev webpack-dev-server
grunt.registerTask('webpack-dev-server', 'Start a webpack-dev-server.', function webpackDevServerTask(cliTarget) {
const done = this.async();

const config = grunt.config([this.name]);
const targets = cliTarget
? [cliTarget]
: config
? Object.keys(config)
: [];
let targets;
if (cliTarget) {
targets = [cliTarget];
} else {
const config = grunt.config.getRaw([this.name]);
targets = config ? Object.keys(config) : [];
}

let runningTargetCount = targets.length;
let keepalive = false;
Expand Down
13 changes: 7 additions & 6 deletions tasks/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ module.exports = (grunt) => {
grunt.registerTask('webpack', 'Run webpack.', function webpackTask(cliTarget) {
const done = this.async();

const config = grunt.config([this.name]);
const targets = cliTarget
? [cliTarget]
: config
? Object.keys(config)
: [];
let targets;
if (cliTarget) {
targets = [cliTarget];
} else {
const config = grunt.config.getRaw([this.name]);
targets = config ? Object.keys(config) : [];
}
let runningTargetCount = targets.length;
let keepalive = false;

Expand Down

0 comments on commit 570f378

Please sign in to comment.