rgaufman PRO said 6 months ago on Deferred Content Loading :
I have this in my app/javascript/controllers/index.js:

import { Application } from '@hotwired/stimulus'
import ContentLoader from '@stimulus-components/content-loader'

const application = Application.start()
application.register('content-loader', ContentLoader)

const context = require.context("controllers", true, /_controller\.js$/)
application.load(definitionsFromContext(context))


When I try to do assets:precompile I get:

Compiling...
Compilation failed:
Hash: 6bc275dcedcd4bc36d87
Version: webpack 4.47.0
Time: 1906ms
Built at: 24/05/2024 16:27:09
 9 assets
Entrypoint application = js/application-e34da527d69634484861.js js/application-e34da527d69634484861.js.map
Entrypoint events/index = js/events/index-8b5f53b65bb3b11030a7.js js/events/index-8b5f53b65bb3b11030a7.js.map
[11] ./app/javascript/src/assets/images/icons/weather/wi-na.svg 126 bytes {2} [built]
...
[51] ./app/javascript/packs/application.js + 8 modules 139 KiB {1} [built]
     | ./app/javascript/packs/application.js 80 bytes [built]
     | ./app/javascript/controllers/index.js 439 bytes [built]
     |     + 7 hidden modules
    + 39 hidden modules

ERROR in ./node_modules/@stimulus-components/content-loader/dist/stimulus-content-loader.mjs 2:52-62
Can't import the named export 'Controller' from non EcmaScript module (only default export is available)
 @ ./app/javascript/controllers/index.js
 @ ./app/javascript/packs/application.js


$ egrep -i 'stimulus' package.json
    "@hotwired/stimulus": "^3.2.2",
    "@hotwired/stimulus-webpack-helpers": "^1.0.1",
    "@stimulus-components/content-loader": "^5.0.0",
$ egrep -i "\srails \(7" Gemfile.lock
    rails (7.0.8.3)


UPDATE: My issue was with webpacker, re-installing webpacker seems to have resolved it!