Skip to content
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

css modules do not support extends in dev env: TypeError: Cannot redefine property: $style #1449

Closed
wmzy opened this issue Dec 7, 2018 · 3 comments · Fixed by #1452
Closed

Comments

@wmzy
Copy link

wmzy commented Dec 7, 2018

Version

15.4.0

Reproduction link

https://see.below

Steps to reproduce

  1. Create project by vue-cli
  2. Create two components and mount the `Bar``.
    Foo:
......
<style module lang="scss">
.root {
  color: red;
}
</style>

Bar:

<template>
  <div :class="$style.root">
      There should be black.
  </div>
</template>

<script>
import GameCard from './GameCard.vue';

export default {
  extends: Foo
};
</script>
<style module lang="scss">
.root {
  color: black;
}
</style>
  1. Run npm run serve.

What is expected?

No error and the color is black.

What is actually happening?

TypeError: Cannot redefine property: $style


I think here should be:

        Object.defineProperty(this, ${name}, {
          configurable: true, // !
          get: function () {
            return cssModules[${name}]
          }
        })
@kazupon
Copy link
Member

kazupon commented Dec 14, 2018

Thank you for your reporting!
However, I could not reproduce it.

Can you provide minimum reproduction to us with repository please?

@wmzy
Copy link
Author

wmzy commented Dec 14, 2018

Thanks for reply.
I send a pr for this, you can see the unit test.

@kazupon
Copy link
Member

kazupon commented Dec 14, 2018

oh, sorry.
I'll try to see it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants