Skip to content

Commit

Permalink
all imports should be relative, so individual files can still be impo…
Browse files Browse the repository at this point in the history
…rted from blacklight-frontend npm package

eg local app might

    import 'blacklight-frontend/app/javascript/blacklight/core';
    import 'blacklight-frontend/app/javascript/blacklight/modal';

or

    import Blacklight from 'blacklight-frontend/app/javascript/blacklight/core'
    import Modal from 'blacklight-frontend/app/javascript/blacklight/modal';
  • Loading branch information
jrochkind committed Jan 18, 2024
1 parent 7ff508d commit d8c0ec4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/javascript/blacklight/bookmark_toggle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CheckboxSubmit from 'blacklight/checkbox_submit'
import CheckboxSubmit from './checkbox_submit.js'

const BookmarkToggle = (e) => {
if (e.target.matches('[data-checkboxsubmit-target="checkbox"]')) {
Expand Down
15 changes: 10 additions & 5 deletions app/javascript/blacklight/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import BookmarkToggle from 'blacklight/bookmark_toggle'
import ButtonFocus from 'blacklight/button_focus'
import Modal from 'blacklight/modal'
import SearchContext from 'blacklight/search_context'
import Core from 'blacklight/core'
// ALL imports in this dir, including in files imported, should be RELATIVE
// paths to keep things working in the various ways these files get used, at
// both compile time and npm package run time.

import BookmarkToggle from './bookmark_toggle.js'
import ButtonFocus from './button_focus.js'
import Modal from './modal.js'
import SearchContext from './search_context.js'
import Core from './core.js'


export default {
BookmarkToggle,
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/blacklight/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
can be a turbo-stream that defines some HTML fragementsand where on the page to put them:
https://turbo.hotwired.dev/handbook/streams
*/
import ModalForm from 'blacklight/modalForm'
import ModalForm from './modalForm.js'

const Modal = (() => {
const modal = {}
Expand Down

0 comments on commit d8c0ec4

Please sign in to comment.