How do i reference javascript in app.js in a Phoenix template?

If you were not using webpack, import/export would just work.

To do what you want with webpack requires some webpack foo.

If you don’t need asset bundling, could probably skip webpack. But good luck using any node dependencies…

Hope LiveView serves you well!

EDIT: webpack 5s support for module federation would help here I imagine…https://webpack.js.org/concepts/module-federation/

1 Like