I'm trying to import redux logger v.3.0.6. https://github.com/evgenyrodionov/redux-logger
Attempt 1
import logger from 'redux-logger';
error
Uncaught SyntaxError: The requested module '../node_modules/redux-logger/dist/redux-logger.js' does not provide an export named 'default'
Attempt 2
import { logger } from 'redux-logger';
error
Uncaught SyntaxError: The requested module '../node_modules/redux-logger/dist/redux-logger.js' does not provide an export named 'logger'
Attempt 3
import { createLogger } from 'redux-logger';
error
Uncaught SyntaxError: The requested module '../node_modules/redux-logger/dist/redux-logger.js' does not provide an export named 'createLogger'
The third one is the one suggested on the github page. How do I solve this?
I had the same issue and solved it like this:
import createLogger from 'redux-logger';
// ...
const loggerMiddleware = createLogger;
It seems createLogger is a default export.
I am using like your first attempt and it is working fine,
import logger from "redux-logger";
I am also using the same version - 3.0.6 for both typings and logger itself.
"#types/redux-logger": "^3.0.6",
"redux-logger": "^3.0.6",
This suggestion was given to me in the error i got after installing and importing redux-logger.
the fix i found out is given below.
import pkg from "redux-logger";
const {createLogger}=pkg;
const logger=createLogger()
hope it helps!!
Related
Hi i'm using vuefire with vite when i try to
import { VueFire, VueFireAuth } from 'vuefire'
I get this error :
Uncaught SyntaxError: Function statements require a function name (at chunk-TZOYARRL.js?v=786f7321:13756:9)
This newly installed meteor (1.10.2) by chocolatey on windows 10 followed by meteor create --bare appName then copy/paste some 2 year old code I had parked for a while. Chassing the cause of this runtime error for no avail.
ReferenceError: DataTeckCol is not defined
at server/dataTeck.js:13:1
at module (server/dataTeck.js:20:8)
../server/dataTeck.js
"use strict";
let cheerio = require('cheerio');
import {Matcher} from "./matcher";
import {Dispatcher} from "./dispatcher";
import '../imports/api/dataTeck.js';
DataTeckCol.remove({plateNum: {$in: plates}}); //<<<<<<<< Error line
../imports/api/dataTeck.js
import { Mongo } from 'meteor/mongo';
export const DataTeckCol = new Mongo.Collection('dataTeckCol');
You need to explicitly import the exported const, so instead of
import '../imports/api/dataTeck.js';
you need to import it via
import { DataTeckCol } from '../imports/api/dataTeck.js';
I used Google Analytics a lot for many sites...
I'm just releasing a first app with Firebase (Firestore + Firebase SDK with reactjs).
Then, I activated GA from my Firebase dashboard... but I cannot see any activity !
I probably need not to add plugin like "autotrack" ?
import 'autotrack';
ga('create', 'UA-XXXXX-Y', 'auto');
It's not clear because, it's impossible to find out the track ID (UA-XXXXX-Y) from my dashboard !
Do I really need it ? Where can I find it ?
I did't correctly initialized Analytics...
With firebase it's not a track ID but a measurementId
import app from 'firebase/app';
import 'firebase/analytics';
app.initializeApp({
//other config
measurementId : process.env.REACT_APP_MEASUREMENT_ID,
appId : process.env.REACT_APP_DEV_ID
})
//put inside your constructor
app.analytics()
This will solve the following error:
Error: firebase__WEBPACK_IMPORTED_MODULE_8___default.a.analytics is
not a function react
Documentation : https://firebase.google.com/docs/analytics/get-started?platform=web
The previous answer should be corrected like this:
import app from 'firebase/app';
import 'firebase/analytics';
app.initializeApp({
//other config
measurementId : process.env.REACT_APP_MEASUREMENT_ID,
appId : process.env.REACT_APP_DEV_ID
})
//put inside your constructor
app.analytics()
This will solve the following error:
Error: firebase__WEBPACK_IMPORTED_MODULE_8___default.a.analytics is
not a function react
My issue was the same as listed above:
Error: firebase__WEBPACK_IMPORTED_MODULE_8___default.a.analytics is not a function react
But the resolution was that I forgot to import the analytics module: import 'firebase/analytics';
If you are using Typescript:
// On index.tsx
import { initializeApp } from 'firebase/app';
import { initializeAnalytics } from 'firebase/analytics';
const firebaseConfig = {
... your config object ...
};
const app = initializeApp(firebaseConfig);
initializeAnalytics(app);
Firebase gone through a lot of new updates. Change imports like this;
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
import 'firebase/compat/analytics';
I am working in an Ember.js app and currently trying to connect to firebase (is not my default adapter, the default is a Rest adapter). I followed the instructions given in https://github.com/firebase/emberfire but when I try to read data from the database I get:
Error while processing route: my.routingFile firebase.app is not a function getApp
In brief, this is my routing file:
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
import RouteMixin from 'ember-cli-pagination/remote/route-mixin';
import Ember from 'ember';
import RealtimeRouteMixin from 'emberfire/mixins/realtime-route';
export default Ember.Route.extend(AuthenticatedRouteMixin,RouteMixin, RealtimeRouteMixin, {
firebaseApp: Ember.inject.service(),
model(params) {
return this.store.findAll('myModel');
},
setupController(){
this._super(...arguments);
},
actions:{
}
});
And, my adapter is defined as follows:
import RealtimeDatabaseAdapter from 'emberfire/adapters/realtime-database';
export default RealtimeDatabaseAdapter.extend({
databaseURL: 'https://my-url.firebaseio.com/'
});
My ember-cli version is: 3.0.2
Then, what am I missing?
I'm surprised that it's not working. Your code looks fine to me. Did you define the environment variables for Firebase in config/environment.js?
I'm trying to setup some kind of logging for my meteor app and chose Loggly, I read this article, but I can't get the client-side implementation to work.
// in startup/client/loggly-client.js
import { Meteor } from 'meteor/meteor';
import { winston } from 'meteor/clinical:winston-browser-logging';
winston.info("winston-client has started on the client!");
// in startup/client/index.js
import './loggly-client.js';
import './routes.js';
Error I'm getting is Uncaught TypeError: Cannot read property 'info' of undefined
According to https://github.com/clinical-meteor/winston-browser-logging/blob/master/package.js it should be Winston, not winston.