@@ -2,11 +2,27 @@ import babelify from 'babelify';
2
2
import vueify from 'vueify' ;
3
3
import modulesify from 'css-modulesify' ;
4
4
import tmp from 'tmp' ;
5
+ import through from 'through2' ;
5
6
import { dirs } from '../gulp-tasks/config' ;
6
7
import { customSass } from '../gulp-tasks/compilers' ;
7
8
8
9
const cssBundleFile = tmp . fileSync ( ) ;
9
10
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
+
10
26
export default ( config ) => {
11
27
vueify . compiler . applyConfig ( {
12
28
sass : {
@@ -31,7 +47,7 @@ export default (config) => {
31
47
browserify : {
32
48
output : cssBundleFile . name ,
33
49
debug : true ,
34
- transform : [ babelify , vueify ] ,
50
+ transform : [ consoleAppendfy , babelify , vueify ] ,
35
51
plugin : [ [ modulesify , {
36
52
global : true ,
37
53
generateScopedName ( name , filename ) {
0 commit comments