[Vuejs]-Vue.js browserify Cannot find module

2👍

Those are webpack packages and you are using browserify. If you need to use webpack packages you should be using webpack as your bundler.

I did have a go at installing the vue-upload-component package to see how easy it would be with browserify and elixir but it’s awkward to say the least. I didn’t get it working because it uses babel transforms to compile the vue files, so first you need to pull them in manually and then you would likely need to write an elixir extension to use those transforms to get it to work. Obviously each webpack package will be different so you would need to do that each time you install one, which is hardly convenient.

0👍

I had some luck changing the configuration output of the Vue component I wanted to use to use webpack -p instead of just webpack.

I could then take that output without the hot module code and put it through browserify:

browserify file.js --standalone SomeLibrary > file.browser.js

Where file.js is the webpack -p output, SomeLibrary is the name you want on the global window scope from the browserify packaging, and file.browser.js is your resultant file to include in your project.

Leave a comment