samedi 25 novembre 2017

How to require a js package in Laravel 5.5 project when using bower dependency Management tool?

I have a project based on Laravel 5.5. In this project, I want to add tempusdominus bootstrap-3 datetimepicker. Since this package does not have npm installer, I installed bower then installed it like so

npm install -g bower
bower init
bower install tempusdominus-core#latest --save

Now the package is installed in a bower_components folder of my Laravel project. However, I am unable to require this package into my app.js file.

window.datetimepicker = require('tempusdominus/core'); window.datetimepicker = require('eonasdan-bootstrap-datetimepicker'); window.datetimepicker = require('/bower_components/tempusdominus-core/build/js/core.min.js');

I tried requiring the package using the following but Laravel Mix keeps failing to compile and gives me the following error

This dependency was not found: * /bower_componenets/tempusdominus-core/build/js/core.min.js

This is how I run Laravel-Mix

npm run watch

How can I successfully require a package that was installed via bower into Laravel Mix?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2A6l567
via IFTTT

Aucun commentaire:

Enregistrer un commentaire