My internship defense is on monday and I’m trying to have something to put in my report. For my defense I want to present openmrs offline but I just want to be able to apply offline just for patient registration at the moment. At least something I can demo. I tried using a java module but the way openmrs is architectured makes it almost impossible to register a service worker with the appropriate scope. Now I’ve turned to owa and I’m facing some issues.
I just used the openmrs owa generator to scaffold a simple web app. It has the following directory structure
Inside index.html, I tried including the test.js using
But I get a 404 for error
I’m fairly new to the owa generator and the directory structure is a bit strange to me. I could still remove everything and just use bower for dependency management but I want to benefit from the live reload so I’ll like to understand the current architecture more.
OWAs are packaged with webpack. In order to add a js library you first do
npm install your_library --save and then you just import the library in your js code e.g. https://github.com/openmrs/openmrs-module-metadatamapping/blob/master/owa/app/js/metadatamapping.js#L12
It will be automatically packaged by webpack with your app.
There should be no need to modify index.html. Whenever you want to add a UI element, you do it by implementing a component and adding it to the page. I found this tutorial quite helpful: https://thinkster.io/angularjs-es6-tutorial
How did you create the scaffolding? Did you use openmrs-sdk:create-project? The directory structure doesn’t seem to be up-to-date, which may imply you used an old version of a generator. I’d recommend using SDK, which should always fetch the latest version of a generator.
@raff I get this error when I try to scaffold an app using the sdk
When I use yo openmrs-owa to scaffold a new app, it’s scaffolded successfully but when I try to build using
npm run build:prod
I get the following error even though I’ve not made any changes to the app
The second error is easy to fix. But it would be great of the generator didn’t allow that through
I get this when I deploy the app