0
votes

I made the react app using create-react-app and installed firebase : 8.2.3, but while importing firebase in App.js I am getting error "Cannot use import statement outside a module" and my app doesn't run. here are my package.json configuration:

{ "name": "sample-app", "version": "0.1.0", "private": true, "dependencies": { "firebase": "^8.2.3", "gh-pages": "^3.1.0", "react": "^16.14.0", "react-dom": "^16.14.0", "react-lazyload": "^3.1.0", "react-lines-ellipsis": "^0.14.1", "react-router-dom": "^5.2.0", "react-scripts": "0.9.x", "react-test-renderer": "^17.0.1", "zustand": "^3.1.4" },

"devDependencies": {}, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "predeploy": "npm run build", "deploy": "gh-pages -d build" } }

show us your import statement - Michael.Lumley
Can you show us what's your folder structure looks like? For importing any module inside a CRA app, you'd just need to import firebase from "firebase/app" and that should work just fine - ale917k