Select to view content in your preferred language

Cannot use import statement outside a module

811
1
Jump to solution
06-24-2022 02:40 PM
GregoryBologna
Occasional Contributor II

I am porting a calcite JS page to Wordpress. 

Adding calcite reference in PHP throws error

 

 

 

wp_enqueue_style( 'esri-calcite', 'https://js.arcgis.com/calcite-components/1.0.0-beta.81/calcite.css' , false, null, 'all');
wp_enqueue_script('esri-calcite', 'https://js.arcgis.com/calcite-components/1.0.0-beta.81/calcite.esm.js', false, null, true);

 

 

 

 
 

 

Uncaught SyntaxError SyntaxError: Cannot use import statement outside a module at (program) (https://js.arcgis.com/calcite-components/1.0.0-beta.81/calcite.esm.js:6:1)

arg0:SyntaxError: Cannot use import statement outside a module {stack: 'SyntaxError: Cannot use import statement outside a module', message: 'Cannot use import statement outside a module'}

No debugger available, can not send 'variables'
(program) @ js.arcgis.com/calcite-components/1.0.0-beta.81/calcite.esm.js:6

 

 

0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor II

Try loading the non-esm version like this https://js.arcgis.com/calcite-components/1.0.0-beta.81/calcite.js

That should work better in a wordpress env

View solution in original post

0 Kudos
1 Reply
ReneRubalcava
Frequent Contributor II

Try loading the non-esm version like this https://js.arcgis.com/calcite-components/1.0.0-beta.81/calcite.js

That should work better in a wordpress env

0 Kudos