Open lbreal opened 3 months ago
Hi,
here is a minimal example: https://github.com/jvail/glpk.js/blob/master/examples/lp.html If you adjust your import/script then it should work out of the box.
Thanks for answering!
I'm still encountering difficulties using GLPK.js in my local development environment, even after trying different approaches. Here are the issues I'm facing:
Approach 1: Local File Import ( import GLPK from '../dist/index.js';) I'm unable to import GLPK.js as a module from a local file.
The error in console is: Access to script at 'file:///C:/Users/luiza/Documents/Documentos/PO/jogos/meu_jogo/glpk.min.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted.
Approach 2: CDN Import ( import GLPK from 'https://cdn.jsdelivr.net/npm/glpk.js@4.0.2/dist/glpk.min.js';)
When I try to import GLPK.js as a module from a CDN, I get a different error: Uncaught SyntaxError: The requested module 'https://cdn.jsdelivr.net/npm/glpk.js@4.0.2/dist/glpk.min.js' does not provide an export named 'default' (at teste.html:6:16)
The code used is the following:
<!DOCTYPE html>
The error in console is: Access to script at 'file:///C:/Users/luiza/Documents/Documentos/PO/jogos/meu_jogo/glpk.min.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted.
Yes, that is normal. If you want to develop locally I propose to use serve. That is what I do as well:
npx serve
Hello,
I am facing a problem with GLPK.js. Even after downloading the glpk.min.js file and including it locally in my project, I keep getting the error "Uncaught ReferenceError: glpk is not defined".
My HTML code is as follows: <<!DOCTYPE html>