Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

124
Vistas
How to use a module in firefox extension?

So I am building a very simple extension for firefox. The problem I have is that I cannot import the js file I need in order to make it work.

Extension Structure

root-
|-------manifest.json
|-------index.html
|-------phoenix.js
|-------msg.js

As you can see I have all the files at the same level.

In my manifest, I have:

//manifest.json
    {
    
      "manifest_version": 2,
      "name": "Socket",
      "version": "1.0",
    
      "description": "Simple extension test",
    
      "icons": {
        "48": "icons/border-48.png"
      },
    
      "content_scripts": [
        {
          "matches": ["<all_urls>"],
          "js": ["phoenix.js", "msg.js"]
        }
      ],

      "background": {
        "scripts": [
           "phoenix.js", "msg.js"
        ]
      }
    
    }

In my index.html I have:

<!DOCTYPE html>

<html>
<head>
<title>Test</title>
<meta charset="uth-8">
</head>

<body style="background:black; color:white">

<!-- Msg board -->

<!-- Type bar and Send btn -->

</body>

<script src="./phoenix.js">  </script>
<script src="./msg.js">  </script>

</html>

In my msg.js I am trying to import the phoenix.js in order to create a socket and connect to my backend Elixir websocket server.

//msg.js

import {Socket} from "phoenix" // I also tried "./phoenix"

So the big issue is I can't seem to import the phoenix. I tried to have it as background script and also as content script.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

"background":[
        "phoenix.js", "msg.js"
      ]

may need to be:

"background": {
    "scripts": [
      "phoenix.js", "msg.js"
    ]
  }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda