vuejs / vueify

Browserify transform for single-file Vue components
MIT License
1.17k stars 152 forks source link

Fixes #138 Fixes #162 Optionally apply config #179

Open thomas07vt opened 7 years ago

thomas07vt commented 7 years ago

options._flags is not always set when using browserify transformations

Example of failure in gulp file

// gulpfile.js
gulp.task('all', function() {
    process.env.NODE_ENV = 'production';
    return browserify('./source/js/all.js')
        .transform(babelify.configure({ presets: ["es2015"]}))
        .transform(vueify)
        .bundle()
        .pipe(source('./js/all.js'))
        .pipe(buffer())
        .pipe(rev())
        .pipe(gulp.dest(pub))
        .pipe(rev.manifest('./build/rev-manifest.json', {
          base: '',
          merge: true
        }))
        .pipe(gulp.dest('.'));
});
$ gulp all

[19:15:56] Using gulpfile ~/gulpfile.js
[19:15:56] Starting 'all'...
code/node_modules/vueify/index.js:12
    sourceMap: options._flags.debug
                             ^

TypeError: Cannot read property 'debug' of undefined
    at vueify (code/node_modules/vueify/index.js:12:30)
thomas07vt commented 7 years ago

I don't actually know if this is the "correct" fix for this issue since I am still working on getting my first Vue app running, but it is a fix :)

paul-maxime commented 7 years ago

Looks like a duplicate of #172, but I approve this fix.