vuejs / vueify

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

hardcoded "vue" reference causes compilation error #194

Open osuwariboy opened 7 years ago

osuwariboy commented 7 years ago

Okay, so I've been trying to make the browserify-simple example work with browserify-shim module and stumbled upon an issue that seems related to this one.

In my case, the fact that the reference to vue was hardcoded at line 160 in the compiler.js file meant that if I did this inside my package.json:

"browserify-shim": {
    "myVue": "global:Vue"
  }

I'd get an error when compiling in "normal" mode, so to speak. The error being

Cannot find module vue from ...

In order to make this work, either I set the value to exactly "vue", like this:

"browserify-shim": {
    "vue": "global:Vue"
  }

or change the compilation context in the command by setting NODE_ENV=production while I'm compiling. This behavior is quite unexpected given that with just about every other modules(Jquery, Three, whatever), you can pretty much give them the name you want and it'll work provided you give the proper import/require statement.