Vue-material: More build issues

Created on 10 Jan 2017  ·  3Comments  ·  Source: vuematerial/vue-material

@marcosmoura You're going to hate me :(

So with the change you just made to externals, now using Vue and VueMaterial from

All 3 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:

  externals: {
    vue: {
        commonjs: "vue",
        commonjs2: "vue",
        amd: "vue",
        root: "Vue",
    }
  }

When using export type umd, we can specify the external name for each type, allowing us to normally use vue for module imports, and Vue for script tag usage.

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!
The window variable was created to work with the standalone build, to use the Vue.use(VueMaterial).
But with the new externals this become obsolete:

  externals: {
    vue: {
      commonjs: 'vue',
      commonjs2: 'vue',
      amd: 'vue',
      root: 'Vue',
      var: 'Vue'
    }
  }

Thanks a lot @korylprince!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Feduch picture Feduch  ·  3Comments

tridcatij picture tridcatij  ·  3Comments

xinzhanguo picture xinzhanguo  ·  3Comments

bryanspearman picture bryanspearman  ·  3Comments

Leshgan picture Leshgan  ·  3Comments