shahryarjb

shahryarjb

Problem to import a js file from `/static/js` (Uncaught Error: Cannot find module)

Hello, I have read this post Importing js libs in files outside of main app.js and tried to import a js file and edited my webpack.config.js, but I still have this error: Uncaught Error: Cannot find module 'ckeditor'

Anyway, I tested it like these lines in app.js:

import {Ckeditor} from "ckeditor"
or
import 'ckeditor'; 
or
import {Ckeditor} from './ckeditor';
or
import "../js/ckeditor.js"

or the other way and my webpack.config.js is like this:

entry: {
      'app': glob.sync('./vendor/**/*.js').concat(['./js/app.js']),
      'ckeditor': ['./js/ckeditor.js'].concat(glob.sync('./vendor/**/*.js')),
    },

by the way, my js file is located in ‍asset/static/js‍ folder

Thanks, Please help me to import my js file.

Most Liked

kokolegorille

kokolegorille

The --prefix assets is meant to be run from the root of the project.

If You are already inside assets, do not use the parameter…

And if You are looking for version 5, the package is ckeditor5.

kokolegorille

kokolegorille

Static dir is meant for files not going through webpack bundling…

Instead, You should simply add the package.

npm i ckeditor --prefix assets/

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement