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

230
Views
¿Cómo llamar a una función incluida con un paquete web con javascript externo?

¿Cómo llamar a una función incluida con un paquete web con javascript externo?

El archivo webpack.js consta de:

 const init = (inputUrl) => { // window.onload = function(){ init.loadMap = function(inputUrl){ const wrap = document.querySelector('#px'); Px.Core.Initialize(wrap, function(){ Px.Loader.LoadFbx({ // url: '../src/model/Bumma_004/Bumma_004.FBX', url: inputUrl, onLoad: function(){ console.log("FBX Loading Complete"); console.log(inputUrl); } }) }) } init.getconfig = function getconfig(){ return url; } // init.getconfig = getconfig; function test(msg){ return console.log('test function completed ' + msg); } init.test = test; // } } export default init;

El archivo index.js está compuesto de la siguiente manera.

 import init from './temp.js' init.loadMap('abc');

Después de agrupar webpack.js, quiero poner otra URL en index.js en init.loadMap y enviarla a html.

Sin embargo, en el archivo index.js, Cannot use import statement outside a module en la primera línea.

¿Como puedó resolver esté problema?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

arreglado usando global.init = init

about 4 years ago · Juan Pablo Isaza Report
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!