@@ -2,11 +2,27 @@ import babelify from 'babelify';
22import vueify from 'vueify' ;
33import modulesify from 'css-modulesify' ;
44import tmp from 'tmp' ;
5+ import through from 'through2' ;
56import { dirs } from '../gulp-tasks/config' ;
67import { customSass } from '../gulp-tasks/compilers' ;
78
89const cssBundleFile = tmp . fileSync ( ) ;
910
11+ // Just hook window.console to throw vue warn
12+ const consoleAppendfy = ( ) => through ( function ( buf , enc , next ) {
13+ const hook = `
14+ const error = console.error;
15+ console.error = function(warning, ...args) {
16+ if (/(Vue warn)/.test(warning)) {
17+ throw new Error(warning);
18+ }
19+ error.apply(console, [warning, ...args]);
20+ };
21+ ` ;
22+ this . push ( hook + buf . toString ( 'utf8' ) ) ;
23+ next ( ) ;
24+ } ) ;
25+
1026export default ( config ) => {
1127 vueify . compiler . applyConfig ( {
1228 sass : {
@@ -31,7 +47,7 @@ export default (config) => {
3147 browserify : {
3248 output : cssBundleFile . name ,
3349 debug : true ,
34- transform : [ babelify , vueify ] ,
50+ transform : [ consoleAppendfy , babelify , vueify ] ,
3551 plugin : [ [ modulesify , {
3652 global : true ,
3753 generateScopedName ( name , filename ) {
0 commit comments