Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
Estoy tratando de requerir un archivo en el entorno del paquete web, pero la ruta de una variable comete un error
 this.data = require("/static/content/" + this.place + "/main.json")

esto es trabajo

 this.path = "/static/content/" + this.place this.data = require(this.path + "/main.json")

Esto es malo.

El error se ve así:

 Uncaught Error: Cannot find module '/static/content/Suzanne/main.json' at webpackEmptyContext (.json$:2:1) at EExplore.init (EExplore.js:9:21) at new EExplore (EExplore.js:3:1) at Module.1213 (explore.js:5:1) at __webpack_require__ (bootstrap:24:1) at __webpack_exec__ (explore.js:39:1) at explore.js:39:1 at Function.__webpack_require__.O (chunk loaded:23:1) at explore.js:39:1 at webpackJsonpCallback (jsonp chunk loading:521:1)

Estoy realmente confundido.

¿Hay alguna diferencia entre estas dos formas?

El archivo de configuración de mi paquete web está aquí si lo necesita

 devServer: { watchFiles: ["src/**", "static/**"], static: { watch: true, directory: path.join(__dirname, "./static"), }, }, plugins: [ ... new CopyWebpackPlugin({ patterns: [ { from: path.resolve(__dirname, "./static"), to: "static/", }, ], }),
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!