TypeError: langs[(("../../lang/" + (intermediate value)) + ".json")] is not a function
See original GitHub issueHi,
I’ve tried installing this package and followed the documentation for Vite, but I’m getting the following error in the console.
Uncaught (in promise) TypeError: langs[(("../../lang/" + (intermediate value)) + ".json")] is not a function
I am getting this on a fresh installation of Laravel Jetstream and the installation of this package
laravel new example --jet
npm i laravel-vue-i18n
vite.config.js
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import vue from "@vitejs/plugin-vue";
import i18n from "laravel-vue-i18n/vite";
export default defineConfig({
plugins: [
laravel({
input: "resources/js/app.js",
refresh: true,
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
i18n(),
],
});
app.json
import "./bootstrap";
import "../css/app.css";
import { createApp, h } from "vue";
import { createInertiaApp } from "@inertiajs/inertia-vue3";
import { InertiaProgress } from "@inertiajs/progress";
import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers";
import { ZiggyVue } from "../../vendor/tightenco/ziggy/dist/vue.m";
import { i18nVue } from "laravel-vue-i18n";
const appName =
window.document.getElementsByTagName("title")[0]?.innerText || "Laravel";
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) =>
resolvePageComponent(
`./Pages/${name}.vue`,
import.meta.glob("./Pages/**/*.vue")
),
setup({ el, app, props, plugin }) {
return createApp({ render: () => h(app, props) })
.use(i18nVue, {
resolve: async (lang) => {
const langs = import.meta.glob("../../lang/*.json");
return await langs[`../../lang/${lang}.json`]();
},
})
.use(plugin)
.use(ZiggyVue, Ziggy)
.mount(el);
},
});
InertiaProgress.init({ color: "#4B5563" });
Am I stupid and am I forgetting something or is something not working properly ?
Issue Analytics
- State:
- Created a year ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Uncaught TypeError: (intermediate value)(...) is not a function
This means that without that semicolon, the anonymous window.Glog function was being invoked with a function as the msg parameter, followed by ( ......
Read more >TypeError (intermediate value)(...) is not a function in JS
The "TypeError: (intermediate value)(...) is not a function" error occurs when we forget to place a semicolon between a function declaration and an...
Read more >TypeError: (intermediate value).then is not a function - Reddit
I want to create a function that checks if a database exists in mongodb and if not, creates it. But I get this...
Read more >[Autocomplete] TypeError: (intermediate value ... - GitHub
I am integrating autocomplete component in my website. it is crashing when we type anything in the autocomplete field.
Read more >Uncaught TypeError: (intermediate value)(...) is not a function
JavaScript : Uncaught TypeError : ( intermediate value )(...) is not a function [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I resolved that issue when I used Server Side Rendering. It didn’t work in other ways.
So, to help others:
In my
app.js
file I have:While in my
vite.config.js
I have:In this way works fine.
Thanks guys!