vendredi 27 septembre 2019

EmberJs - unable to implement dynamic-import-polyfill

We are trying to implement dynamic-import-polyfill to import external file Ember compile time(build time).

Followed steps mentioned in https://github.com/GoogleChromeLabs/dynamic-import-polyfill

but got stuck when adding following lines of code in ember-cli-build.js.

following line of import works fine ,because with this I can successfully bring ember server up

import dynamicImportPolyfill from 'dynamic-import-polyfill';

but as soon as I am adding following lines ,ember server throws exception on start and stops

dynamicImportPolyfill.initialize({     modulePath: '/web-app', // Defaults to '.'     importFunctionName: '$$$import' // Defaults to 'import'   });

When checked in error logs found following error

stack: ReferenceError: location is not defined at Object.e.initialize (C:\code\Project-Chimps\source\web-app\node_modules\dynamic-import-polyfill\dist\dynamic-import-polyfill.umd.js:1:366)

tried lots of sites but no where I got the proper example:

while defining dynamicImportPolyfill.initialize({.... what should be the value for modulePath:

I did not understand following info mentioned for modulePath

modulePath string
A path for which all relative import URLs will resolve from.

Default Value: '.'

This should be an absolute path to the directory where your production modules are deployed (e.g. /public/). If given a relative path, it is resolve against the current page's URL.

Someone please help us with the example how I can use dynamic-import-polyfill with EmberJs




Aucun commentaire:

Enregistrer un commentaire