atomiks / tippyjs

Tooltip, popover, dropdown, and menu library
https://atomiks.github.io/tippyjs/
MIT License
11.93k stars 520 forks source link

RequireJS thinks tippy.js is a file, not a package #846

Closed crystalfp closed 4 years ago

crystalfp commented 4 years ago

Bug description

Typescript correctly imports thetippy.js package. RequireJS instead consider "tippy.js" a JavaScript file and refuses to map it to another file to be loaded instead.

Besides looking at RequireJS and/or Typescript for a solution, could the package name be changed to something more standard like "tippyjs" or "tippy-js"?

Reproduction

My typescript module contains: import tippy from "tippy.js"; Compiling it with module: "amd" correctly generates:

define(["require", "exports", "tippy.js"], function (require, exports, tippy_js_1) { ...

But at runtime the loading fails because RequireJS tries to load the non-existent JavaScript file "tippy.js" from the server root instead of looking at the RequireJS path mapping: "tippy.js": "../node_modules/tippy.js/dist/tippy-bundle.umd".

atomiks commented 4 years ago

Too late to change the package name at this stage I think, especially just for RequireJS which is not widespread in use anymore.

crystalfp commented 4 years ago

Solved by putting tippy.js in the packages section of RequireJS configuration.