Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
DXF parser in vanilla JS

I am currently working on a CNC project, I want to be able to parse DXF files into objects in JS. I started with SVGs instead but the drawings did not export as shapes but as lines (a square as four lines and not a shape with four points). So I began to search for a JS library that would help me work with DXF files, I found "dxf-parser" and "three-dxf". I wasn't able to run an example with neither... That might be because I have a very limited experience with vanilla JS , I usually use P5.

So, in conclusion, I am searching for a working example projects of any of these libraries.

What I did by now was to write in the command line:

npm init -y
npm i dxf parser

Then I opened an html file:

<!DOCTYPE html>
<html lang="en">
  <head>
</script>
    <meta charset="utf-8" />
  </head>
  <body>
    <main>
    </main>
    <script type="module" src="index.js"></script>
  </body>
</html>

And a JS file:

// Grab fileText in node.js or browser
import parse from 'dxf-parser';

const fileText = "./dxfTests/test.dxf";

try {
    const dxf = parse(fileText);
}catch(err) {
    console.log(err.stack);
}

Then I start click the go live button in VScode and i get this error:

127.0.0.1/:1 Uncaught TypeError: Failed to resolve module specifier "dxf-parser". Relative references must start with either "/", "./", or "../".

Help would be very much appreciated!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda