New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More build issues #312
Comments
I now have a working solution, that I believe is the correct solution. The webpack docs leave much to be desired but after reading full configuration docs here is the syntax that works for both module import and script tags:
When using export type Does this make sense? I can now understand the hate javascript build environments get... Things never seem to be as simple as they first appear. I apologize for giving you a half-baked solution last time. |
Also, one other question which I think is related. In index.js, you set window.VueMaterial. I can't see anywhere in the entire source where you ever use it again; It looks like you coded this very close to the first release. This doesn't seem to be a common practice among other Vue plugins. It defeats one of the purposes of using webpack and modules: keeping things contained. Webpack and friends take care of getting VueMaterial to the right place. My guess is that this is just a forgotten piece of code that should probably be removed since your current webpack takes care of making that variable available. |
The externals trick worked flawlessly! externals: {
vue: {
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue',
root: 'Vue',
var: 'Vue'
}
} Thanks a lot @korylprince!!! |
* origin/master: [release] 0.6.3 [build] 0.6.3 fix standalone build #312
* 'master' of https://github.com/marcosmoura/vue-material: (680 commits) update supported browsers fix import names (#345) add gitter channel URL add gitter badge fix comment add Gitter Channel update the number of rows if the data set changes on mdTable (#320) [release] 0.6.3 [build] 0.6.3 fix standalone build #312 [release] 0.6.2 [build] 0.6.2 fix alias for webpack [release] 0.6.1 [build] 0.6.1 remove ignore on bundle fix md-icon-button with pallete colors inside cards #307 [release] 0.6.0 [build] 0.6.0 fix one line dialogs in certain browsers #219 ...
…cker * origin/master: [build] 0.7.0 add speed dial code examples [release] 0.7.0 [build] 0.7.0 update supported browsers [release] 0.6.3 [build] 0.6.3 fix standalone build #312
* origin/master: [build] 0.7.0 add speed dial code examples [release] 0.7.0 [build] 0.7.0 update supported browsers [release] 0.6.3 [build] 0.6.3 fix standalone build #312
…cker * origin/master: [build] 0.7.0 add speed dial code examples [release] 0.7.0 [build] 0.7.0 update supported browsers [release] 0.6.3 [build] 0.6.3 fix standalone build #312
@marcosmoura You're going to hate me :(
So with the change you just made to externals, now using Vue and VueMaterial from <script> tags is broken. I've done some more research and I (think) know what the problem is, but not how to fix it (yet.)
The externals appears to search two places: in a global javascript variable, and for an imported package.
When externals is {vue: Vue} building with webpack fails because there is no global variable Vue (since webpack hides globals behind functions)
When externals is {vue: vue} building succeeds because vue resolves to a module. But now a <script> import fails because vue is not the global variable it expects, Vue is.
So either more advanced externals configuration is required, or there needs to be something else configured to support both. I've looked at vue-router, vuex, and vuefire as examples, but none of them seem to use webpack to build.
Here's the current error using <script> tags:
Inserting a script between vue and vue-material's script tags with
var vue = Vue;
fixes the issue, but obviously that's not a good solution...The text was updated successfully, but these errors were encountered: