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

Incompatible with standard vue-cli webpack build #2

Open
ctoLarsson opened this issue May 19, 2017 · 1 comment
Open

Incompatible with standard vue-cli webpack build #2

ctoLarsson opened this issue May 19, 2017 · 1 comment

Comments

@ctoLarsson
Copy link

I really like this project, unfortunately it seems incompatible with a standard vue-cli built project. Replicate:

vue init webpack my-project
npm install vue-canvas-gauges --save

add the include from readme:
import { LinearGauge, RadialGauge } from 'vue-canvas-gauges'

=> doesn't compile, I suppose some incompatibility with the webpack config. Hope can be fixed.

@daniel-shuy
Copy link

daniel-shuy commented Aug 16, 2017

I had the same issue.

Digging into the source code, I figured out the issue is due to index.js using module.exports, which is ES5 syntax; together with import, which is ES6 syntax, which is no longer allowed in Webpack version 2.2.0-rc.5 onwards (see webpack/webpack#3997).

The temporary workaround is to explicitly import from LinearGauge.vue/RadialGauge.vue, eg:

<template>
  <div>
    <RadialGauge :options="{ value: 233 }"></RadialGauge>
    <LinearGauge :value="377"></LinearGauge>
  </div>
</template>

<script>
import LinearGauge from 'vue-canvas-gauges/src/LinearGauge'
import RadialGauge from 'vue-canvas-gauges/src/RadialGauge'

export default {
  // ...
  components: {
    LinearGauge,
    RadialGauge
  }
}
</script>

daniel-shuy added a commit to daniel-shuy/canvas-gauges that referenced this issue Aug 16, 2017
sdkrocks added a commit to sdkrocks/vue-canvas-gauges that referenced this issue Jul 19, 2022
Fix vue-bulma#2: Change module.exports to export
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants