primeui icon indicating copy to clipboard operation
primeui copied to clipboard

Primeui not working in modular environment

Open Mobe91 opened this issue 7 years ago • 0 comments

I have been trying hard to get primeui working using the SystemJS module loader. I have documented my efforts in this thread. I tried using AMD and CJS module formats.

Importing primeui in AMD format results in the following error:

Unhandled rejection (SystemJS) Multiple anonymous defines in module http://localhost:9000/jspm_packages/npm/[email protected]/primeui.js
	Error: Multiple anonymous defines in module http://localhost:9000/jspm_packages/npm/[email protected]/primeui.js
	    at eval (http://localhost:9000/jspm_packages/npm/[email protected]/primeui.js:274:9)
	    at eval (http://localhost:9000/jspm_packages/npm/[email protected]/primeui.js:285:2)
	    at eval (http://localhost:9000/jspm_packages/npm/[email protected]/primeui.js:14801:3)
	    at eval (<anonymous>)
	    at r (http://localhost:9000/jspm_packages/npm/[email protected]/js/browser/bluebird.min.js:33:7722)
	    at i._settlePromiseFromHandler (http://localhost:9000/jspm_packages/npm/[email protected]/js/browser/bluebird.min.js:32:13044)
	    at i._settlePromise (http://localhost:9000/jspm_packages/npm/[email protected]/js/browser/bluebird.min.js:32:13847)
	    at i._settlePromise0 (http://localhost:9000/jspm_packages/npm/[email protected]/js/browser/bluebird.min.js:32:14548)
	Evaluating http://localhost:9000/jspm_packages/npm/[email protected]/primeui.js
	Error loading http://localhost:9000/jspm_packages/npm/[email protected]/primeui.js as "npm:[email protected]/primeui.js" from http://localhost:9000/jspm_packages/npm/[email protected]

Importing primeui in CJS format works fine but no widget factories are invoked. When I invoke the imported module manually, only the last factory is invoked of the list of widget factories listed in sequence in primeui.js. This is because the module.exports is overwritten each time.

I got primeui working in a non-modular environment using browser globals. So maybe I am overlooking something but I have no idea how this is supposed to work in a modular setup.

Thanks for any pointers.

Mobe91 avatar Mar 19 '18 22:03 Mobe91