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

dateFns is not defined #30

Open
Voidmine opened this issue Aug 6, 2017 · 8 comments
Open

dateFns is not defined #30

Voidmine opened this issue Aug 6, 2017 · 8 comments

Comments

@Voidmine
Copy link

Voidmine commented Aug 6, 2017

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

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

@Voidmine Voidmine closed this as completed Aug 6, 2017
@Voidmine Voidmine reopened this Aug 6, 2017
@TomKaltz
Copy link

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

import Vuetiful from 'vuetiful/src/main.js'
Vue.use(Vuetiful)

@litti
Copy link

litti commented Aug 30, 2017

Please see 7ff9035#diff-11e9f7f953edc64ba14b0cc350ae7b9d for a possible fix.

@RIanDeLaCruz
Copy link

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

@litti
Copy link

litti commented Sep 3, 2017

@RIanDeLaCruz What exactely is the issue?

@RIanDeLaCruz
Copy link

@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
Copy link

vmitchell85 commented Sep 14, 2017

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
Copy link

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
Copy link

greentec commented Dec 14, 2018

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

<script src='https://cdnjs.cloudflare.com/ajax/libs/date-fns/1.27.1/date_fns.min.js'></script>

from author's original code

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

7 participants