question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"TypeError: a is not a function" in production builds

See original GitHub issue

Reporting a bug?

I’m using “vue-i18n” and “@intlify/vite-plugin-vue-i18n”, while everything is fine in development, in production build I keep getting “TypeError: a is not a function” which is referring to this: const l = a( o, (function (e, t, n, o, r, i) { return { warnHtmlMessage: r, onError: (e) => { throw (i && i(e), e); }, onCacheKey: (e) => ((e, t, n) => Td({ l: e, k: t, s: n }))(t, n, e), }; })(0, n, r, 0, s, i) ); I’ve seen similar bugs with new report comments on #747 and #719

Expected behavior

since my application is a multi-language dashboard, this error cause it to have no text and empty. it basically should work as normal and returns translated keys.

Reproduction

I’ve added my package.json in system info if needed.

System Info

"scripts": {
    "dev": "vite",
    "build": "vue-tsc --noEmit && vite build",
    "serve": "vite preview",
    "prepare": "husky install",
    "lint:eslint": "vue-tsc --noEmit --ext .ts,.vue && eslint --ext .js,.ts,.vue .",
    "lint:style": "stylelint ./src/**/*.{vue,scss} --fix",
    "test:unit": "jest",
    "test:unit:coverage": "pnpm test:unit -- --coverage"
  },
  "dependencies": {
    "@intlify/vite-plugin-vue-i18n": "^3.3.1",
    "@quasar/extras": "^1.10.11",
    "@types/moment-jalaali": "^0.7.5",
    "@types/stylelint": "^13.13.3",
    "@vee-validate/i18n": "^4.5.7",
    "@vee-validate/rules": "^4.5.7",
    "@vueuse/core": "^6.0.0",
    "axios": "^0.21.1",
    "jalali-moment-timezone": "^2.0.4",
    "moment": "^2.29.1",
    "moment-jalaali": "^0.9.4",
    "moment-timezone": "^0.5.33",
    "oidc-client": "^1.11.5",
    "pinia": "^2.0.0-rc.6",
    "quasar": "^2.0.3",
    "url-template": "^2.0.8",
    "vee-validate": "4.5.7",
    "vue": "^3.2.2",
    "vue-i18n": "9.2.0-beta.30",
    "vue-router": "^4.0.11",
    "vue3-persian-datetime-picker": "^1.2.0"
  },
  "devDependencies": {
    "@commitlint/cli": "^13.1.0",
    "@commitlint/config-conventional": "^13.1.0",
    "@types/jest": "^27.0.1",
    "@types/url-template": "^2.0.28",
    "@typescript-eslint/eslint-plugin": "^4.29.2",
    "@typescript-eslint/parser": "^4.29.2",
    "@vitejs/plugin-vue": "^1.4.0",
    "@vue/compiler-sfc": "^3.2.4",
    "@vue/test-utils": "^2.0.0-rc.12",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^3.4.0",
    "eslint-plugin-vue": "^7.16.0",
    "husky": "^7.0.1",
    "jest": "^27.0.6",
    "lint-staged": "^11.1.2",
    "prettier": "^2.3.2",
    "sass": "^1.39.0",
    "stylelint": "^13.13.1",
    "stylelint-config-css-modules": "^2.2.0",
    "stylelint-config-prettier": "^9.0.3",
    "stylelint-config-recommended-scss": "^4.3.0",
    "stylelint-config-standard": "^22.0.0",
    "stylelint-csstree-validator": "^1.9.0",
    "stylelint-scss": "^3.21.0",
    "ts-jest": "^27.0.5",
    "typescript": "^4.3.5",
    "vite": "^2.5.0",
    "vite-plugin-pages": "^0.17.3",
    "vite-plugin-vue-layouts": "^0.3.1",
    "vue-eslint-parser": "^7.10.0",
    "vue-jest": "^5.0.0-alpha.10",
    "vue-tsc": "^0.2.3"
  },

Screenshot

No response

Additional context

No response

Validations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
Eliophotcommented, Mar 24, 2022

ok I fixed it with the runtimeOnly option to false (vite.config.js file) :

import vueI18n from '@intlify/vite-plugin-vue-i18n'

export default defineConfig({
    plugins: [
        vue(),
        vueI18n({
            runtimeOnly: false,
            include: path.resolve(__dirname, './path/to/src/locales/**')
        })
    ],
3reactions
myWsqcommented, Mar 8, 2022

Build with minify off: TypeError: messageCompiler is not a function

CleanShot 2022-03-08 at 17 21 24@2x
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 11 production fails with error: ERROR TypeError
After doing that, production build completely fails, because rxjs-compat is apparently used, even though with Shift + Ctrl + F in Visual Studio ......
Read more >
How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript TypeError: "x" is not a function occurs when calling a function on a value or object, which is not actually a...
Read more >
TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
JavaScript: Uncaught TypeError: n is not a function
This error occurs if you try to execute a function that is not initialized or is not initialized correctly. This means that the...
Read more >
Re: arcgis core 4.23 breaks app when build - Esri Community
However when i build the app (npm run build) the maps don't load anymore. ... Uncaught (in promise) TypeError: _ is not a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found