Skip to content

how to use locale using importmap? #2902

Answered by buncis
buncis asked this question in Q&A
Discussion options

You must be logged in to vote

if you all want to use locale and import map you could do this instead

import the file use unpkg because its more complete than the jspm counterpart

for indonesian the command is

bin/importmap pin flatpickr@4.6.13/dist/l10n/id.js --from unpkg

and then in ur javascript files add import "flatpickr/dist/l10n/id.js"

then you could do it like in the docs

here is my final stimulus controller files

import { Controller } from "@hotwired/stimulus"
import flatpickr from 'flatpickr';
import confirmDatePlugin from "flatpickr/dist/plugins/confirmDate/confirmDate"
import "flatpickr/dist/l10n/id.js"

export default class extends Controller {
  connect() {
    flatpickr(this.element, {
      "plugins": [n…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by buncis
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants