• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

106
Views
Importar módulos de Javascript en el proyecto de complemento Yeoman Excel

Estoy tratando de crear un complemento de Excel con el generador Yeoman . En el archivo excel_project/src/taskpane/taskpane.js me gustaría llamar a la biblioteca ' fs '. Cuando ejecuto taskpane.js solo en mi terminal, todo funciona bien. Sin embargo, cuando inicio todo el proyecto de Excel ( npm start en mi terminal) tengo un error de importación de módulo (ver imagen). Es como si los módulos no se pudieran importar en el complemento de Excel... ¿Alguien tiene alguna idea? Gracias por tu ayuda.

Aquí está el archivo taskpane.js , como si lo hubiera creado Yeoman. Acabo de agregar const fs = require('fs'); // this gives the error

 Office.onReady((info) => { if (info.host === Office.HostType.Excel) { document.getElementById("sideload-msg").style.display = "none"; document.getElementById("app-body").style.display = "flex"; document.getElementById("run").onclick = run; } }); export async function run() { try { const fs = require('fs'); // this gives the error await Excel.run(async (context) => { const range = context.workbook.getSelectedRange(); let text = document.querySelector('textarea').value; // Read the range address range.load("address"); // Update the fill color range.format.fill.color = "yellow"; await context.sync(); console.log(`The range address was ${range.address}.`); }); } catch (error) { console.error(error); } }

Aquí está el mensaje de error: ingrese la descripción de la imagen aquí

almost 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error