reactjsmeteormeteor-react

Meteor ionic 5 react


I have installed ionic in meteor 1.10 and importing ionic components gives me this error

 Cannot read property 'dynamicImport' of undefined

the app code has nothing

 import React from "react";
 import {IonApp} from "@ionic/react";


 export const App = () => (
   <IonApp>
   test
   </IonApp>
 );

I have not worked with Meteor but I suppose it is some problem of the way that imports the components

Any idea how to fix it ??


Solution

  • I ran into this same issue when upgrading to Meteor 1.10 in our app which uses ionic 5 and we were able to work around the issue by causing Meteor to package the commonjs version of ionic instead of the ES5 version.

    The solution was to update the package.json in the @ionic/core loader and specify the common js entry point for the “browser” build (which the Meteor build tool will favor).

    app/node_modules/@ionic/core/loader/package.json

    {
      "name": "ionic-loader",
      "typings": "./index.d.ts",
    +  "browser": "./index.cjs.js",
      "module": "./index.mjs",
      "main": "./index.cjs.js",
      "node:main": "./node-main.js",
      "jsnext:main": "./index.es2017.mjs",
      "es2015": "./index.es2017.mjs",
      "es2017": "./index.es2017.mjs",
      "unpkg": "./cdn.js"
    }
    

    We’re tracking that one file in our repository as well in case we need to update (or reinstall) npm packages and the change gets undone.