JeffreyWay / laravel-elixir-vueify

This is a very thin wrapper for Laravel Elixir and the Browserify Vueify plugin.
156 stars 30 forks source link

Compile issues #22

Open erikwestlund opened 8 years ago

erikwestlund commented 8 years ago

Using version 1.04 (same issue on 1.03), I'm running into this problem. See below. It started out of the blue -- I never had seen the issue before. No files were changed since a successful recompile, but I did switch operating systems from Ubuntu to Mac.

Latest node/npm/gulp installed using homebrew.

Everything compiles down if I exclude my vue components.

Mac-Pro:xxxxxx erik$ gulp
(node:26009) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[00:09:23] Using gulpfile ~/code/xxxxxxx/gulpfile.js
[00:09:23] Starting 'default'...
[00:09:23] Starting 'browserify'...

Fetching Browserify Source Files...
   - resources/assets/js/admin.js

Saving To...
   - public/assets/js/admin.js

[00:09:23] Finished 'default' after 395 ms
/Users/erik/code/xxxxxxx/node_modules/vueify/lib/compiler.js:59
  Object.keys(config).forEach(function (key) {
         ^

TypeError: Cannot convert undefined or null to object
    at EventEmitter.compiler.applyConfig (/Users/erik/code/xxxxxxx/node_modules/vueify/lib/compiler.js:59:10)
    at vueify (/Users/erik/code/xxxxxxx/node_modules/vueify/index.js:8:12)
    at nr (/Users/erik/code/xxxxxxx/node_modules/module-deps/index.js:289:23)
    at /Users/erik/code/xxxxxxx/node_modules/resolve/lib/async.js:44:21
    at ondir (/Users/erik/code/xxxxxxx/node_modules/resolve/lib/async.js:187:31)
    at /Users/erik/code/xxxxxxx/node_modules/resolve/lib/async.js:153:39
    at onex (/Users/erik/code/xxxxxxx/node_modules/resolve/lib/async.js:93:22)
    at /Users/erik/code/xxxxxxx/node_modules/resolve/lib/async.js:24:18
    at FSReqWrap.oncomplete (fs.js:117:15)
jimping commented 8 years ago

Same here. vueify@8.7.0

kriskornel commented 8 years ago

Me too. I had problem when trying to compile vue-strap using browserify

erikwestlund commented 8 years ago

@jonnyxe and @korneliuskristianr

if you continue to have issues, I'd suggest moving to elixir 6.0.0.0+ and using webpack.

takes a little work to get going but you'll avoid compile issues and be "on the same page" with jeffrey

JeffreyWay commented 8 years ago

If someone can give more information as to what's causing this, please comment so we can fix it.

nbyloff commented 8 years ago

I am having the same issue. I have been trying to figure out where the issue is coming from. If I set the config variable in the compiler.js file right before the each statement like this config = {}; I get a different error. The error will be different for other people I imagine, but something is wrong with communicating with browserify.

Saving To...
   - public/js/app.js

[18:34:12] gulp-notify: [Laravel Elixir] Browserify Failed!: Unexpected token

/home/vagrant/code/tmp_app/node_modules/vue-strap/src/spinner.scss:10
$brand-primary: darken(#428bca, 6.5%); // #337ab7

I am not quite sure what browserify config object is missing, but I haven't changed anything in my gulpfile. This is my current gulpfile.js (for months). I'm still looking since this has me at a stand still, but thought I'd post if it helped anyone else.

elixir(function(mix) {
    mix.less('app.less')
       .browserify('app.js', null, null, { paths: 'vendor/laravel/spark/resources/assets/js' })
       .copy('node_modules/sweetalert/dist/sweetalert.min.js', 'public/js/sweetalert.min.js')
       .copy('node_modules/sweetalert/dist/sweetalert.css', 'public/css/sweetalert.css');
});
nbyloff commented 8 years ago

For whatever reason, vue-strap seems to be sending undefined to vueify. If you look at this line in vueify/index.js

module.exports = function vueify (file, options) {
  if (!/.vue$/.test(file)) return through()
    console.log(file);
  console.log(options);
  compiler.applyConfig(options)

I get an undefined variable for options when the file is something from the vue-strap module (like Carousel.vue).

Not sure why though

nbyloff commented 8 years ago

Looks like it this commit is what caused the problem; when they added the options & applyConfig.

https://github.com/vuejs/vueify/commit/af96700d16f3f1630b7972758a874b7743240979

antongorodezkiy commented 7 years ago

For now ended up with

let
  modal = require('vue-strap/dist/vue-strap.min').modal;
  // instead of:
  // modal = require('vue-strap/src/Modal.vue');