Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_b.getLineAndCharacterOfPosition is not a function #149

Closed
2 tasks done
DhivinX opened this issue Jul 2, 2022 · 1 comment
Closed
2 tasks done

_b.getLineAndCharacterOfPosition is not a function #149

DhivinX opened this issue Jul 2, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@DhivinX
Copy link

DhivinX commented Jul 2, 2022

Describe the bug

After run with vueTsc: true option:

node:internal/event_target:777
  process.nextTick(() => { throw err; });
                           ^
TypeError [Error]: _b.getLineAndCharacterOfPosition is not a function
    at normalizeTsDiagnostic (C:\Users\dszar\OneDrive\Pulpit\nx-vnts\node_modules\vite-plugin-checker\lib\logger.js:157:79)
    at normalizeVueTscDiagnostic (C:\Users\dszar\OneDrive\Pulpit\nx-vnts\node_modules\vite-plugin-checker\lib\logger.js:245:22)
    at reportDiagnostic (C:\Users\dszar\OneDrive\Pulpit\nx-vnts\node_modules\vite-plugin-checker\lib\checkers\vueTsc\main.js:59:82)
    at Array.forEach (<anonymous>)
    at emitFilesAndReportErrors (C:\Users\dszar\OneDrive\Pulpit\nx-vnts\node_modules\vite-plugin-checker\lib\checkers\vueTsc\typescript-vue-tsc\lib\tsc.js:101605:21)
    at Object.result.afterProgramCreate (C:\Users\dszar\OneDrive\Pulpit\nx-vnts\node_modules\vite-plugin-checker\lib\checkers\vueTsc\typescript-vue-tsc\lib\tsc.js:101773:13)       
    at synchronizeProgram (C:\Users\dszar\OneDrive\Pulpit\nx-vnts\node_modules\vite-plugin-checker\lib\checkers\vueTsc\typescript-vue-tsc\lib\tsc.js:102061:22)
    at Object.createWatchProgram (C:\Users\dszar\OneDrive\Pulpit\nx-vnts\node_modules\vite-plugin-checker\lib\checkers\vueTsc\typescript-vue-tsc\lib\tsc.js:101976:9)
    at Object.configureServer (C:\Users\dszar\OneDrive\Pulpit\nx-vnts\node_modules\vite-plugin-checker\lib\checkers\vueTsc\main.js:96:13)
    at MessagePort.<anonymous> (C:\Users\dszar\OneDrive\Pulpit\nx-vnts\node_modules\vite-plugin-checker\lib\worker.js:75:24)
Emitted 'error' event on Worker instance at:
    at Worker.[kOnErrorMessage] (node:internal/worker:289:10)
    at Worker.[kOnMessage] (node:internal/worker:300:37)
    at MessagePort.<anonymous> (node:internal/worker:201:57)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:562:20)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28)

After run with typescript: true option everything works but without type checking for *.vue files.

Reproduction

Here is repo: https://github.com/DhivinX/nx-vnts

  • npm i vue-tsc@latest -D
  • add configuration to vite.config.ts
  • run dev server

Expected behavior

I don't know if it's a bug or my monorepo settings are causing this error.
If I was wrong, please help.

But..
When I manually run the type check with vue-tsc package then everything works fine.

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
    Memory: 23.90 GB / 31.91 GB
Binaries:
    Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (103.0.1264.44)
    Internet Explorer: 11.0.22000.120
npmPackages:
    vite-plugin-checker: ^0.4.7 => 0.4.7

Additional context

vite.config.ts

import path from 'path';
import { defineConfig } from 'vite';
import tsconfigBase from '../../tsconfig.base.json';
import Vue from '@vitejs/plugin-vue';
import Components from 'unplugin-vue-components/vite';
import { quasar, transformAssetUrls } from '@quasar/vite-plugin';
import vueI18n from '@intlify/vite-plugin-vue-i18n';
import checker from 'vite-plugin-checker';

const resolve = (p: string) => path.resolve(__dirname, p);

const tsconfigBaseAliases = (rootOffset: string): Record<string, string> => {
    const paths = tsconfigBase.compilerOptions?.paths || [];
    const aliases: Record<string, string> = {};

    for (const [name, path] of Object.entries(paths))
        aliases[name] = resolve(`${rootOffset}/${path}`);

    return aliases;
};

export default defineConfig({
    server: {
        host: true,
        port: 8080,
    },

    clearScreen: true,
    assetsInclude: /\.(pdf|jpg|png|svg)$/,

    resolve: {
        alias: {
            '@/': `${resolve('./src')}/`,
            ...tsconfigBaseAliases('../..'),
        },
    },

    publicDir: resolve('./src/public'),

    plugins: [
        Vue({
            template: {
                transformAssetUrls,
            },
        }),

        vueI18n({
            include: resolve('./src/locales/**'),
        }),

        quasar({
            sassVariables: resolve('./src/assets/quasar.scss'),
        }),

        Components({
            dirs: ['src/app/components'],
        }),

        checker({
            vueTsc: true,
        }),
    ],
});

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@fi3ework
Copy link
Owner

fi3ework commented Jul 2, 2022

It's a bug due to the diagnosis is not reported from a specific line but a typescript project setting. I will fix this later and you can fix the project issue first as a workaround.

image

@fi3ework fi3ework added the bug Something isn't working label Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants