test: compile webpack config for dev and prod

This commit is contained in:
endiliey 2018-08-11 15:19:53 +08:00
parent a4f0ed7c94
commit f07e7791fa
5 changed files with 72 additions and 48 deletions

12
test/webpack/compile.js Normal file
View file

@ -0,0 +1,12 @@
import webpack from 'webpack';
export default function compile(config) {
return new Promise((resolve, reject) => {
webpack(config, (err, stats) => {
if (err || stats.hasErrors()) {
reject(new Error(`Failed to compile with errors`));
}
resolve('Compiled successfully');
});
});
}