Jackie
Jackie

Reputation: 23607

Webpack will not resolve JQuery-UI Definitions

I have the following code in my TS file...

require("jquery-ui/ui/widgets/datepicker.js");
require("angular-ui-date/dist/date.js");

When I run the code I get the following error...

Module not found: Error: Cannot resolve module 'jquery-ui/datepicker' in //code/my-app/node_modules/angular-ui-date/dist @ ./~/angular-ui-date/dist/date.js 3:66-97

So I ran tsd install jqueryui --save and then added the following to the same file as the require...

/// <reference path="../../../typings/jqueryui/jqueryui.d.ts" />

based on src/main/typescripts but I still get the same warning when running webpack

Upvotes: 1

Views: 3227

Answers (2)

user2164402
user2164402

Reputation: 11

I added an alias to the resolve object in the webpack configuration file.

'resolve' : {
  'alias' : {
    'jquery-ui/datepicker' : 'jquery-ui/ui/widgets/datepicker'
  },
},

Upvotes: 1

Jorawar Singh
Jorawar Singh

Reputation: 7621

It seems to be a issue with latest version you are using. It has nothing to do with type definition. if you open angular-ui-date/dist/date.js you will find that it is requiring

require("jquery-ui/datepicker")

which does not exist to workaround you could change it manually to require("jquery-ui/ui/widgets/datepicker") but that's a ugly solution i think. There is also an issue on github and there is also suggestion for workaround

Please see the isse here

Upvotes: 1

Related Questions