vuetiful
vuetiful copied to clipboard
dateFns is not defined
When I try to use this, I get an error that says:
Uncaught ReferenceError: dateFns is not defined at Object.defineProperty.value
If you're using webpack and have the proper loaders configured you can...
import Vuetiful from 'vuetiful/src/main.js'
Vue.use(Vuetiful)
Please see https://github.com/andrewcourtice/vuetiful/pull/34/commits/7ff9035bb78b229fc0101362e1a85488ccb5dd6b#diff-11e9f7f953edc64ba14b0cc350ae7b9d for a possible fix.
@TomKaltz Which loaders are needed? I have the default from Vue CLI, and running npm run build
causes an issue
@RIanDeLaCruz What exactely is the issue?
@litti a named export was getting errors in the build
Solved it by manually adding Vuetiful to my babel-loader.
Is there another way?
I did the following:
-
yarn add date-fns
- Added
window.dateFns = require('date-fns');
to my main.js
file
I am using Laravel and Laravel Mix though, so YMMV.
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.