kalkatfyodor

kalkatfyodor

Uncaught TypeError: import_alpine.default.start is not a function

Although Alpine seems to be working OK, I see this error in my console:

Any idea why is this happening and how can I fix it?

All the searches on Google point me to TypeScript but I am not using TS.

Most Liked

NobbZ

NobbZ

The Alpine.js you downloaded from the CDN is not a module.

When I tried it the way you did, esbuild complained exactly about that.

If you want to use it as a module, then you need to either use npm to isntall it or clone from GitHub and build it, though it has dependencies, which are usually pulled from NPM (the service).

There might be ways to vendor them, though that will again require extra work, and might recurse infinitely, as dependencies have the habbit to also have dependencies.

Okay, I have to admit, the list is short for alpine, its about a handfull of deps. But its still annoying.

So perhaps you can use npm (the tool) or yarn to use alpine from GitHub? Though I am not sure how that will deal with dependencies and if you can override transient dependencies to use GitHub instead of NPM (the service).

kalkatfyodor

kalkatfyodor

Thanks for your info. You seem to be quite knowledgeable about JavaScript and related tech.

Do you know about some one-file replacement to Alpine? Something I can import from the vendor folder like that topbar.js? I was thinking about Petite Vue but I have not enough knowledge with JS tech, unlike you.

Thank you in advance for your opinion.

NobbZ

NobbZ

I’m not any knowledgeable in the JS ecosystem, but I just went through a similar process as you, as I wanted to try to avoid NPM (the tool).

I now built alpinejs once from source and vendored the resulting module in the project.

I also added a small script which I could pass in a version number and it would rebuild in a container and then replace the vendored module.

This way I can avoid using NPM (the tool) on a daily basis.

I have no problems with NPM (the service), similar to how I do not have problems with hex.pm. If you do not trust one of the package services, you can’t trust any other.

Last Post!

aphilas

aphilas

Bumped into this today and didn’t want to resort to using npm.

Vendoring Solution:

wget -O assets/vendor/alpinejs.js https://unpkg.com/alpinejs@3.15.2/dist/module.esm.min.js
  • Import the package
import Alpine from '../vendor/alpinejs'

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New

Other popular topics Top

grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31494 112
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement