andrewcourtice / vuetiful

Vuetiful is a component framework written on top of the Vue reactive library. It is primarily designed for creating business/administration applications where the displaying of data is paramount.
MIT License
488 stars 108 forks source link

dateFns is not defined #30

Open Voidmine opened 7 years ago

Voidmine commented 7 years ago

When I try to use this, I get an error that says:

Uncaught ReferenceError: dateFns is not defined at Object.defineProperty.value

TomKaltz commented 7 years ago

If you're using webpack and have the proper loaders configured you can...

import Vuetiful from 'vuetiful/src/main.js'
Vue.use(Vuetiful)
litti commented 7 years ago

Please see https://github.com/andrewcourtice/vuetiful/pull/34/commits/7ff9035bb78b229fc0101362e1a85488ccb5dd6b#diff-11e9f7f953edc64ba14b0cc350ae7b9d for a possible fix.

RIanDeLaCruz commented 7 years ago

@TomKaltz Which loaders are needed? I have the default from Vue CLI, and running npm run build causes an issue

litti commented 7 years ago

@RIanDeLaCruz What exactely is the issue?

RIanDeLaCruz commented 7 years ago

@litti a named export was getting errors in the build

Solved it by manually adding Vuetiful to my babel-loader.

Is there another way?

vmitchell85 commented 7 years ago

I did the following:

  1. yarn add date-fns
  2. Added window.dateFns = require('date-fns'); to my main .js file

I am using Laravel and Laravel Mix though, so YMMV.

razbakov commented 6 years ago

I have the same problem.

My package.json:

 "dependencies": {
    "core-js": "^2.4.1",
    "date-fns": "^1.28.2",
    "vue": "^2.5.2",
    "vue-router": "^3.0.1",
    "vuetiful": "github:andrewcourtice/vuetiful"
  },

my vue file:

<script>
import Vuetiful from 'vuetiful/dist/components/components.bundle';
Vue.use(Vuetiful);

and some js and markup from datatable example.

I have error in js console: ReferenceError: dateFns is not defined

I think it is better remove dateFns dependency from library and make it optional.

greentec commented 5 years ago

If you want to use date-fns via Script tag, add this to your HTML file.

from author's original code