Home > OS >  Typescript - TS1192: Module has no default export
Typescript - TS1192: Module has no default export

Time:10-06

I am developing application in vue3 with typescript support. I do not know why but every time I compile code with npm it shows me this:

TS1192: Module '"/home/admin/Desktop/projects/myProj/frontend/components/SectionTitle.vue"' has no default export.

by the way I have enabled allowSyntheticDefaultImports in my tsconfig.json

"compilerOptions": {
        "outDir": "dist",
        "removeComments": true,
        "lib": ["DOM", "ES2020", "ES2020.Promise"],
        "module": "es2020",
        "target": "es2015",
        "allowJs": true,
        "jsx": "preserve",
        "moduleResolution": "node",
        "allowSyntheticDefaultImports": true,
    },
webpack version: 5.50.0
typescript version: 2.8.3

How do I export components

export default defineComponent({
...
})

CodePudding user response:

Try

const component = defineComponent({
    
    })
    
export default component;

CodePudding user response:

Install typescript 4.3.2

package.json

"typescript": "4.3.2",
  • Related