I have an error when migrating from Laravel mix to Laravel vite, I think the problem is in the app.js also I am using vue laravel sail WSL 2 and doock - vuejs3

this is the error that shows when i run the npm run dev after deleting all the laravel mix plugin etc
failed to load config from /var/www/html/vite.config.js
error when starting dev server:
Error: Cannot find module 'laravel-vite-plugin'
Require stack:
- /var/www/html/vite.config.js
- /var/www/html/node_modules/vite/dist/node/chunks/dep-5e7f419b.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/var/www/html/vite.config.js:36:42)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at _require.extensions.<computed> [as .js] (file:///var/www/html/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:62103:24)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19)
#[tag:error]
app.js with all required changed with inport + in my project there is not a bootstrap.js folder or a app.css file
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
import * as Vue from 'vue';
import * as VueRouter from 'vue-router';
import routes from './routes';
import axios from 'axios'
import VueAxios from 'vue-axios'
import Form from './utilities/Form';
import lodash from 'lodash';
import VueAutosuggest from "vue-autosuggest";
import BootstrapVue3 from 'bootstrap-vue-3'
import mitt from 'mitt';
import Vuetable from 'vue3-vuetable';
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue-3/dist/bootstrap-vue-3.css'
import VueSweetalert2 from 'vue-sweetalert2';
import 'sweetalert2/dist/sweetalert2.min.css';
import Toast, { POSITION } from "vue-toastification";
import "vue-toastification/dist/index.css";
import VueApexCharts from "vue3-apexcharts";
const router = VueRouter.createRouter({
history: VueRouter.createWebHistory(),
routes,
});
const emitter = mitt();
export default router;
const app = Vue.createApp({});
app.config.performance = true;
import('./functions').functions(app);
app.config.globalProperties.emitter = emitter;
app.use(router);
app.use(VueAxios, axios);
app.use(VueAutosuggest);
app.use(lodash)
app.use(BootstrapVue3)
app.use(Vuetable)
app.use(Toast, {
position: POSITION.BOTTOM_RIGHT
});
app.use(VueApexCharts);
app.use(VueSweetalert2);
import lodash from 'lodash';
import axios from 'axios';
window.Form = Form;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
//LOGIN COMPONENTS/PARTIALS//
app.component('login-header', require('./components/login-header').default);
app.component('fill-email', require('./components/Partials/fillEmail').default);
app.component('side-bar', require('./components/Partials/side-bar').default);
app.component('top-nav-bar', require('./components/Partials/top-nav-bar').default);
app.component('laravel-pagination', require('./components/Partials/laravel-pagination').default);
app.component('row-height', require('./components/Partials/row-height').default);
app.component('validation-errors', require('./components/Partials/validation-errors').default);`
file containing vite.config.js with plugin for vue and vite
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
// import react from '#vitejs/plugin-react';
import vue from '#vitejs/plugin-vue';
export default defineConfig({
plugins: [
laravel([
'resources/css/app.css',
'resources/js/app.js',
]),
// react(),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
resolve: {
alias: {
'#': '/resources/js'
}
}
});

Related

How to import Oh Vue Icons inside Nuxt 3?

Normally in Vue I have main.ts file so I can just import and mount Vue icon into the app, for example:
import { createApp } from 'vue'
import { OhVueIcon, addIcons } from 'oh-vue-icons'
import { MdDragindicator, HiTrash, HiPlus, HiSolidSearch, BiTextLeft, BiTypeH1, BiTypeH2, BiTypeH3, BiHr, BiQuote } from 'oh-vue-icons/icons'
import '#/assets/css/main.css'
import App from './App.vue'
addIcons(MdDragindicator, HiTrash, HiPlus, HiSolidSearch, BiTextLeft, BiTypeH1, BiTypeH2, BiTypeH3, BiHr, BiQuote)
const app = createApp(App)
app.component('v-icon', OhVueIcon)
app.mount('#app')
So how can I do the same thing in Nuxt 3 where I only have nuxt.config.ts

TypeError: navigation.getChildNavigation is not a function. (In 'navigation.getChildNavigation(route.key)'

I wanted to integrate Redux with React-navigation. Created all the structure for the implementation. But, I am getting the above error and I am getting no any proper solution. I found some similar error raised by others , but non helped me.
The structure of my project is:
index.js
src=>
actions=>
reducers=>
index.js
loginReducers.js
navigationReducer.js
route=>
InitialAuthRoute.js
ReduxNavigation.js
screens=>
Login.js
index.js
import {AppRegistry} from 'react-native';
import ReduxNavigation from './src/route/ReduxNavigation';
import {name as appName} from './app.json';
import React from 'react';
import {Provider} from 'react-redux';
import {createStore, applyMiddleware} from 'redux';
import reducers from './src/reducers';
import thunk from 'redux-thunk';
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore);
const store = createStoreWithMiddleware(reducers);
const AppContainer = () =>
<Provider store={store}>
<ReduxNavigation/>
</Provider>
AppRegistry.registerComponent(appName, () => AppContainer);
ReduxNavigation.js
import React, { Component } from "react";
import { connect } from "react-redux";
import { addNavigationHelpers } from "react-navigation";
import InitialAuthRoute from "./InitialAuthRoute";
import NavigationReducer from "../reducers/navigationReducer";
class AppNavigation extends Component {
render() {
return (
<InitialAuthRoute navigation={({
dispatch: this.props.dispatch,
state: this.props.navigationState,
})} />
);
}
}
const mapStateToProps = state => {
return {
navigationState: state.nav
};
};
export default connect(mapStateToProps)(AppNavigation);
initialAuthRoute.js
import {createStackNavigator} from 'react-navigation';
import LoginScreen from '../screens/Login'
const PrimaryNav = createStackNavigator({
LoginScreen: { screen: LoginScreen }
}, {
headerMode: 'none',
initialRouteName: 'LoginScreen'
})
export default PrimaryNav
reducers/index.js
import {combineReducers} from 'redux';
import LoginReducers from './loginReducers';
import NavigationReducer from "./navigationReducer";
export default combineReducers({
login: LoginReducers,
nav: NavigationReducer,
})
navigationReducer:
import AppNavigator from "../route/InitialAuthRoute";
const navigationReducer = (state, action) => {
const newState = AppNavigator.router.getStateForAction(action, state);
return newState || state;
};
export default navigationReducer;
Environment:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-5200U CPU # 2.20GHz
Memory: 3.27 GB / 7.92 GB
Binaries:
Node: 12.3.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5522156
Packages:
"react": "16.8.6",
"react-native": "0.60.4",
"react-redux": "^7.1.0",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"react-navigation": "^3.11.1",
"react-navigation-redux-helpers": "^3.0.2",

TypeError: Object(...) is not a function on index.js

Hi i get this error when in my browser when i run my code:
TypeError: Object(...) is not a function
./src/index.js
src/index.js:31
28 | firebaseStateName: 'firebase'
29 | }
30 | const initialState = {};
31 | const store = createStore(rootReducer,initialState,
32 | compose(
33 | applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),
34 | reactReduxFirebase(firebase, config),
i tryed using thing libary:
http://docs.react-redux-firebase.com/history/v3.0.0/docs/integrations/thunks.html
however still no succes :/
below my index.js file
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { createStore, applyMiddleware, compose } from 'redux'
import rootReducer from './store/reducers/rootReducer'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import { createFirestoreInstance, reduxFirestore, getFirestore } from 'redux-firestore';
import { ReactReduxFirebaseProvider, reactReduxFirebase, getFirebase } from 'react-redux-firebase';
import fbConfig from './config/fbconfig'
import firebase from 'firebase/app'
import 'firebase/firestore'
import 'firebase/auth'
import 'firebase/storage'
import 'firebase/functions'
firebase.initializeApp(fbConfig);
firebase.firestore();
firebase.storage().ref();
firebase.functions();
const config = {
useFirestoreForProfile:true,
userProfile: 'Klanten',
userFirestoreForProfile: true,
attachAuthIsReady: true,
firebaseStateName: 'firebase'
}
const initialState = {};
const store = createStore(rootReducer,initialState,
compose(
applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),
reactReduxFirebase(firebase, config),
reduxFirestore(firebase)
)
)
store.firebaseAuthIsReady.then(() => {
const rrfProps = {
firebase,
config: fbConfig,
dispatch: store.dispatch,
createFirestoreInstance
}
ReactDOM.render(<Provider store={store}><ReactReduxFirebaseProvider {...rrfProps}><App /></ReactReduxFirebaseProvider></Provider>, document.getElementById('root'));
serviceWorker.unregister();
})
this is my rootReducer.js
import authReducer from './authReducer'
import shopReducer from './shopReducer'
import { combineReducers } from 'redux'
import { firebaseReducer } from 'react-redux-firebase'
import { firestoreReducer } from 'redux-firestore'
const rootReducer = combineReducers({
firebase: firebaseReducer,
firestore: firestoreReducer,
auth: authReducer,
shop: shopReducer
})
export default rootReducer
This is where your problem is:
reactReduxFirebase(firebase, config),
reduxFirestore(firebase)
There has been a little change in the configuration in the latest version, which you must use if you're using react V6.
*Make sure you install the latest version by typing:
npm i --save react-redux-firebase#next
http://docs.react-redux-firebase.com/history/v3.0.0/docs/v3-migration-guide.html
+ import { ReactReduxFirebaseProvider } from 'react-redux-firebase'
+ import { createFirestoreInstance } from 'redux-firestore'
- import { reactReduxFirebase } from 'react-redux-firebase' // removed
- import { reduxFirestore } from 'redux-firestore' // removed
const store = createStore(
rootReducer,
initialState,
compose(
- reactReduxFirebase(firebase, rrfConfig), // removed
- reduxFirestore(firebase)
// applyMiddleware(...middleware) // removed
)
)
+ const rrfProps = {
+ firebase,
+ config: rrfConfig,
+ dispatch: store.dispatch,
+ createFirestoreInstance // <- needed if using firestore
+ }
const App = () => (
<Provider store={store}>
+ <ReactReduxFirebaseProvider {...rrfProps}>
<Todos />
+ </ReactReduxFirebaseProvider>
</Provider>
);

Firebase Storage is not working with ionic 3 & AngularFire 4.0.0 rc

Firebase Storage is not working with ionic 3 & AngularFire 4.0.0 rc .
returning with this error message.
firebase.storage() takes either no argument or a Firebase App instance
//error
TypeError: this.fb.storage is not a function
//Module
import {NgModule} from '#angular/core';
import {IonicPageModule} from 'ionic-angular';
import {ProfilePage} from './profile';
import 'firebase/storage'
#NgModule({
declarations: [
ProfilePage,
],
imports: [
IonicPageModule.forChild(ProfilePage),
],
exports: [
ProfilePage
]
})
export class ProfilePageModule {
}
//components
import {Component, Inject} from '#angular/core';
import {NavController, IonicPage} from 'ionic-angular';
import {NgForm} from "#angular/forms";
import {AngularFireAuth} from 'angularfire2/auth';
import {AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable} from 'angularfire2/database';
import * as firebase from 'firebase'; // for typings
import { FirebaseApp } from 'angularfire2';
#ionicpage()
#component({
selector: 'page-profile',
templateUrl: 'profile.html',
})
export class ProfilePage {
file:any;
forUpLoadRef: FirebaseListObservable;
userRef: FirebaseObjectObservable;
storageRef:any;
constructor(public navCtrl: NavController, public af: AngularFireAuth,
public db: AngularFireDatabase, private fb: FirebaseApp) {}
UploadNewImage(){
this.file = (document.getElementById('inputFileId')).files[0];
console.log("file recived"+ JSON.stringify(this.file.name));
let storageRef = this.fb.storage().ref();
var metadata = {
contentType: 'image/*'
};
this.storageRef.child('images/'+this.file.name).put(this.file,metadata)
}
}
//error
TypeError: this.fb.storage is not a function
just add import 'firebase/storage'; in your parent module
https://github.com/angular/angularfire2/issues/1015

Child routes error with RC6 upgrade

I am getting this runtime error with my routing when upgrading to RC6 (this includes child routes):
ListingComponent is not part of any NgModule or the module has not
been imported into your module
This error indicates that I have not added ListingComponent to ngModule but it is there as a declaration.
In app.module I have all my components as declarations. I also import my routing component. The routing component has a sub routing component called listing.routes.
Here is my app.module.ts:
import {NgModule, CUSTOM_ELEMENTS_SCHEMA, ReflectiveInjector } from '#angular/core';
import { BrowserModule } from '#angular/platform-browser';
import {FormsModule, FormBuilder} from '#angular/forms';
import { NgClass, NgStyle} from '#angular/common';
import { AppComponent } from './app.component';
import {routing} from './app.routes';
import {ListingModule} from './components/listing/listingmodule';
import {ListingComponent} from './components/listing/listing.Component';
#NgModule({
imports: [BrowserModule, routing],
providers: [],
declarations: [AppComponent, ListingComponent, ListingModule],
bootstrap: [AppComponent]
})
export class AppModule {
}
Here is my app.routes.ts (which I import as routes):
import { ModuleWithProviders } from '#angular/core';
import { Routes, RouterModule } from '#angular/router';
import {ListingRoutes} from './components/listing/listing.routes';
import {SplashComponent} from './components/splash/splash.component';
export const appRoutingProviders: Routes = ([
{ path: '', component: SplashComponent },
{ path: 'login', component: SplashComponent },
...ListingRoutes
]);
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutingProviders);
And here is my listing.routes.ts:
import { ModuleWithProviders } from '#angular/core';
import { Routes, RouterModule } from '#angular/router';
import {ListingModule} from './repairreturnmodule';
import {ListingComponent} from '../listing/listing.component';
export const ListingRoutes: Routes = [
{
path: '',
component: ListingModule,
children: [
{ path: 'listing', component: ListingComponent},
]
}
];
export const ListingRouting: ModuleWithProviders = RouterModule.forChild(ListingRoutes);
Have I missed anything?
EDIT: you are importing your ListingComponent from
import {ListingComponent} from './components/listing/listing.Component';
if you using the same convention from the AppComponent (which you should) you should import from
import {ListingComponent} from './components/listing/listing.component';
See what is the name of the file. The rest of the code looks right.
I'm not sure if this is the source of the problem, but you are declaring a module there in the AppModule, when you should be importing it...
Try moving the ListingModule from declarations array to the imports array.

Resources