oracle-samples / cerner-smart-embeddable-lib

npm project for developers to use in their SMART web app to be embeddable in Cerner’s MPage Workflow
Apache License 2.0
22 stars 31 forks source link

Use XFC's transpiled code, not source #26

Open pgross41 opened 4 years ago

pgross41 commented 4 years ago

This (cerner-smart-embeddable-lib.js#L3):

import Provider from 'xfc/src/provider';

Should be this:

import Provider from 'xfc/lib/provider';

Or better yet:

import { Provider } from 'xfc';

That change will allow apps to import the ES6 module

import 'cerner-smart-embeddable-lib';

Instead of plucking out the pre-built version

import './vendor/cerner-smart-embeddable-lib-1.3.0';

PowerChart errors with the ES6 module because of this spread operator in XFC (possibly other reasons too but this is the first error). It works if cerner-smart-embeddable-lib includes the lib version though.

Using the ES6 module will also allow apps to disable XFC logging by defining process.env.NODE_ENV per the readme. Thus partially resolving these issues:

The info about process.env.NODE_ENV should also be documented on this project's readme. There is no way a user would know the logging is coming from a dependency nor how to disable it.

I say the issues are "partially resolved" because non-webpack users will still have no way to disable logging. XFC should probably provide a run-time config to disable logging so that users of the pre-build .min.js version of cerner-smart-embeddable-lib can turn it off and utilize f-twelve.

pgross41 commented 4 years ago

cc: @james-ingold