Vue-material: theme not getting applied when using webpack context

Created on 7 Jan 2017  路  8Comments  路  Source: vuematerial/vue-material

I recently updated from 0.2 to 0.5.X and noticed that no themes get applied at all.

I narrowed the bug down to my webpack configuration and specifically the context & output.publicPath options, but have not figured out where exactly the problem is.

Steps to reproduce

  1. Clone my repo: https://github.com/fiws/vue-material-bug-300
  2. run yarn install
  3. run yarn dev

Which browser?

All Browsers, since 0.5.X i think (the big breaking theme change i guess)

What is expected?

All components are styled using the default theme.

What is actually happening?

No component has seems to have a theme at all. They have the md-theme-default class, but that class does not apply any styles.

question

All 8 comments

The theme engine works on your browser. So this is probably not related to your webpack config.
Did you set up your themes correctly (following the new docs)? Did you see the Breaking Changes?

i think so, i set no theme at all, so the default theme should be applied, no?

Yes. Can you upload part of your code in Codepen?

yea, but its basically a hello world app. It works on codepen.

As I said, i think it is build related.

I will take a look at this and I report back, ok?

@fiws Okay, so the error is actually pretty simple.

You're using the HtmlWebpackPlugin which inserts the built javascript into index.html. But you also included it with a script tag. So it is running your javascript twice.

You just need to remove the script tag from index.html and everything will work right.

I will close this issue for now. If something comes up you can ask on the new Gitter Channel. Thank you!

Thanks @korylprince that fixed it. I am pretty surprised that including all my js x2 did not cause any other major problems.. :O

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lovepluskaka picture lovepluskaka  路  3Comments

xinzhanguo picture xinzhanguo  路  3Comments

korylprince picture korylprince  路  3Comments

diverted247 picture diverted247  路  3Comments

Feduch picture Feduch  路  3Comments