0

I have to include https://www.npmjs.com/package/vue2-daterange-picker in my project made with Kendo, Vue, .Net, Angular and jQuery(Yes it's a lot).

<script src="https://unpkg.com/vue2-daterange-picker@0.5.1/dist/vue2-daterange-picker.umd.min.js"></script>

I am including it via this in my scripts and when I try to use, it throws error Uncaught ReferenceError: DateRangePicker is not defined.

I have even declared it in my js file

Vue.component('date-range-picker', DateRangePicker)

How to resolve this?

I am also using bundles.Add(new ScriptBundle()) but I am unable to add the dependency through that also.

BeaST 30
  • 696
  • 1
  • 10
  • 22
  • This is because no such string `DateRangePicker` inside this script. Maybe, you need another script? – Anton Aug 27 '20 at 15:13

1 Answers1

0

As the documentation says. This script is installed via npm or yarn which means you need some kind of bundler, like webpack to build your dependencies and your scripts (e.g. into one file).

Fact that you're using jQuery, KendoUI, Vue and Angular and not using any bundler is a little weird. It seems that if you want to use vue2-datepicker-range you'll need to use bundler of some sort.

Magiczne
  • 1,586
  • 2
  • 15
  • 23
  • I am using ScriptBundle via the statement `bundles.Add(new ScriptBundle`. But I am unable to add the dependency through that also – BeaST 30 Aug 27 '20 at 17:20
  • As far as I know ScriptBundle only merges files, does nothing like building or transpiling - so it's not goot. I should say "Build system" instead of "bundler" in my answer. – Magiczne Aug 27 '20 at 17:28