Closed christiannelson closed 3 weeks ago
Sometimes you just have to write out a bug report before figuring out the issue.
Importing the .mjs
variant fixes the issue.
# config/importmap.rb
pin "choices.js", to: "https://cdn.jsdelivr.net/npm/choices.js@11.0.2/public/assets/scripts/choices.mjs"
Going to close this since I figured out the issue.
Describe the bug
Switching from v10.2.0 to v11.0.2, I'm now unable to import Choices. Note: everything, including Choices, works correctly with v10.2.0.
The error with v11.0.2 is:
SyntaxError: Importing binding name 'default' cannot be resolved by star export entries.
When I use https://arethetypeswrong.github.io/?p=choices.js%4011.0.2 to see what might be wrong, the results are not encouraging. Note, https://arethetypeswrong.github.io/?p=choices.js%4010.2.0 produces a clean report.
I can't quite tell what's wrong, but it looks like v11 isn't exporting in a way that the browser can understand. Or (more likely?), how I'm importing the library isn't supported with v11; perhaps there's something unusual about Rails' importmaps?
Thanks! If I can test anything, please let me know and I'll happily report back.
More context: I'm working in a Rails App that's using importmaps, the related code snippets are (for reference):
To Reproduce See above.
Expected behavior
import Choices from "choices.js";
imports the Choices code without error.Screenshots If applicable, add screenshots to help explain your problem.
Choices version and bundle
Desktop (please complete the following information):