Open Voidmine opened 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)
@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
window.dateFns = require('date-fns');
to my main .js
fileI 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.
If you want to use date-fns via Script tag, add this to your HTML file.
When I try to use this, I get an error that says:
Uncaught ReferenceError: dateFns is not defined at Object.defineProperty.value