chrismccord / phoenix_brunch_vue

5 stars 0 forks source link

This application no longer works #1

Open brweber2 opened 8 years ago

brweber2 commented 8 years ago

Vue now has vue.js, vue.common.js and vue.min.js in the dist directory. The vue.common.js is causing problems. It would be nice to have a working example with the latest versions of Vue and Phoenix. I would send in a pull request, but I'm not actually sure what the best way to fix this is...? If you can provide some guidance I'm happy to give it a try.

chrismccord commented 8 years ago

PR's accepted. I have never used vue, but I put this together as an example to help someone who was stuck. Thanks!

brweber2 commented 8 years ago

The relevant js files are:

node_modules/vue/dist/vue.js node_modules/vue/dist/vue.min.js node_modules/vue/dist/vue.common.js

when brunch-config.js has the following config:

npm: { enabled: true // Whitelist the npm deps to be pulled in as front-end assets. // All other deps in package.json will be excluded from the bundle. ,whitelist: ["phoenix", "phoenix_html", "vue"] }

It appears that "vue" brings in "vue.common.js". This causes problems because it is looking for process.env.NODE_ENV which is undefined. However, if I delete vue.common.js and rename vue.js to vue.common.js everything works again. Modifying the dist directory in node_modules/vue hardly seems like the correct solution.

I had been thinking of removing "vue" from the whitelist and configuring "joinTo" explicitly, but if vue is in node_modules it seems to get picked up no matter what... I think I'm missing something here conceptually, but I'm not sure what it is yet.

Is there a way to configure the whitelist similar to the joinTo so I can be explicit about which js file I want to include on the client?

josevalim commented 8 years ago

I think the process.env.NODE_ENV issue may be fixed in the 2.2.0 brunch series. But it also seems to be broken on the 2.3.0 series.