I have a Rails 7 application and I am trying to install noUiSlider (https://refreshless.com/nouislider/). Installed via yarn and can confirm the source files are in my app. In my /app/javascript/application.js file I added:
import noUiSlider from 'nouislider'
yet when I try and initialize a slider I get:
Uncaught ReferenceError: noUiSlider is not defined
I can see in my application JS file:
// ../../node_modules/nouislider/dist/nouislider.js
var require_nouislider = __commonJS({
"../../node_modules/nouislider/dist/nouislider.js"(exports2, module4) {
(function(global, factory) {
typeof exports2 === "object" && typeof module4 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.noUiSlider = {}));
})(exports2, function(exports3) {
"use strict";
exports3.PipsMode = void 0;
....
I seem to be missing something obvious here or a Rails 7 specific issue.