-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(dll): fix dll build order (#563)
- Loading branch information
1 parent
788e5d5
commit 25fd1e7
Showing
4 changed files
with
76 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import del from 'del' | ||
import { task, series } from 'gulp' | ||
import loadPlugins from 'gulp-load-plugins' | ||
import webpack from 'webpack' | ||
|
||
import config from '../../config' | ||
|
||
const g = loadPlugins() | ||
const { log, PluginError } = g.util | ||
|
||
// ---------------------------------------- | ||
// Clean | ||
// ---------------------------------------- | ||
|
||
task('clean:dll', (cb) => { | ||
del.sync(config.paths.base('dll')) | ||
cb() | ||
}) | ||
|
||
// ---------------------------------------- | ||
// Build | ||
// ---------------------------------------- | ||
|
||
task('build:dll', (cb) => { | ||
const webpackDLLConfig = require('../../webpack.dll') | ||
const compiler = webpack(webpackDLLConfig) | ||
|
||
compiler.run((err, stats) => { | ||
const { errors, warnings } = stats.toJson() | ||
|
||
log(stats.toString(config.compiler_stats)) | ||
|
||
if (err) { | ||
log('Webpack compiler encountered a fatal error.') | ||
throw new PluginError('webpack', err.toString()) | ||
} | ||
if (errors.length > 0) { | ||
log('Webpack compiler encountered errors.') | ||
throw new PluginError('webpack', errors.toString()) | ||
} | ||
if (warnings.length > 0 && config.compiler_fail_on_warning) { | ||
throw new PluginError('webpack', warnings.toString()) | ||
} | ||
|
||
cb(err) | ||
}) | ||
}) | ||
|
||
// ---------------------------------------- | ||
// Default | ||
// ---------------------------------------- | ||
|
||
task('dll', series( | ||
'clean:dll', | ||
'build:dll', | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters