shahryarjb

shahryarjb

Hello, I updated my project to phoenix 1.6 and I have some errors which do not let me start the project

At first:

after deleting node_modules folder I have this error when I run mix assets.deploy

/elixir # mix assets.deploy
 > js/app.js:17:19: error: Could not resolve "topbar" (mark it as external to exclude it from the bundle)
    17 │ import topbar from "topbar"
       ╵                    ~~~~~~~~

 > js/app.js:19:7: error: Could not resolve "regenerator-runtime/runtime.js" (mark it as external to exclude it from the bundle)
    19 │ import "regenerator-runtime/runtime.js";
       ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I commented them but I do not know what they are


the second error I have

when I run mix assets.deploy my /assets/static which includes images, fonts, js, css and etc are not compiled and I just have a folder in /priv/static/assets which has these file app.js, app.css not the other file I need like phoenix.css and extra css and js file I have on /assets/static

my asset link: mishka-cms/apps/mishka_html/assets at master · shahryarjb/mishka-cms · GitHub
my config: mishka-cms/config/config.exs at master · shahryarjb/mishka-cms · GitHub
my dev: mishka-cms/config/dev.exs at master · shahryarjb/mishka-cms · GitHub

Showing Posts 1 to 6

shahryarjb

shahryarjb OP

as I discovered, all the files which are imported on app.css and app.js like this

@import "./phoenix.css";
@import "../static/css/default-template.css";
@import "../static/css/main.min.css";
@import "../static/css/ckeditor-styles.css";
@import "../static/css/bootstrap.min.css";

when I run mix assets.deploy, they are converted to a single file like app.js or app.css if I want to load files directly on my html I should move the file to priv/static manually, after that I can load it on my html like this

<script defer phx-track-static type="text/javascript" src={Routes.static_path(@conn, "/js/bootstrap.min.js")}></script>

but I still have problem with custom fonts

/elixir # mix assets.deploy

 > static/css/default-template.css:6:8: error: No loader is configured for ".woff" files: static/fonts/Vazir-Regular.woff?7ldoi4
    6 │     url('../fonts/Vazir-Regular.woff?7ldoi4') format('woff');
      ╵         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > static/css/default-template.css:3:12: error: No loader is configured for ".eot" files: static/fonts/Vazir-Regular.eot?7ldoi4
    3 │   src:  url('../fonts/Vazir-Regular.eot?7ldoi4');
      ╵             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > static/css/default-template.css:4:12: error: No loader is configured for ".eot" files: static/fonts/Vazir-Regular.eot?7ldoi4#iefix
    4 │   src:  url('../fonts/Vazir-Regular.eot?7ldoi4#iefix') format('embedd...
      ╵             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > static/css/default-template.css:5:8: error: No loader is configured for ".ttf" files: static/fonts/Vazir-Regular.ttf?7ldoi4
    5 │     url('../fonts/Vazir-Regular.ttf?7ldoi4') format('truetype'),
shahryarjb

shahryarjb OP

I am forced to separate font css file and move it to priv/static manually and load it on root.html.heex directly.

<link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/css/font.css")}/>

it should be noted on phoenix 1.6 Map.get(conn.private, :phoenix_live_view) was changed, if you used it on liveview side you have to change your code but if you used it on api base phoenix project you do not need to change your code

LostKobrakai

LostKobrakai

There’s a step by step guide for upgrading here:

Also I’d suggest comparing with a fresh 1.6 installation, because there’s a few more things different than just not having a node_modules folder.

shahryarjb

shahryarjb OP

I have read this article and I did it with this article help but This is incomplete on old project :sob: and even it has typo problem.

yes I compared with a fresh 1.6 installation, and now I have no error and my project is running

AlchemistCamp

AlchemistCamp

FWIW, I followed the step by step guide you mentioned, hit the same error as @shahryarjb shared, googled and ended up on this thread.

I think the issue is not having set up an esbuild loader to handle the font file-types. Being new to Esbuild myself, I’m not sure what the solution is, but I’ll share it when I find it.

nikolauska

nikolauska

It should work if you just add --loader:.woff=file to esbuild config

10
Post #6
— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews