Skip to content

Unable to load default and exported from vue templates #1351

@jrbasso

Description

@jrbasso

Expected Behaviour

I expect to import default and exported interfaces from ts file/portion. It was working on ts-loader 8.x with webpack 4.x and it's failing on ts-loader 9.x with webpack 5.x.

It even works on ts-loader 8.x using webpack 5.x (not recommended since I believe it's not designed for).

Actual Behaviour

Typescript return the error TS2614 when trying to do an import like import HelloWorld, { HelloProp } from './components/HelloWorld.vue';

See the full output:

(ts-loader-9)$ ./node_modules/.bin/webpack
assets by status 53.1 KiB [cached] 1 asset
orphan modules 416 KiB [orphan] 15 modules
runtime modules 500 bytes 2 modules
./src/main.ts + 14 modules 415 KiB [built] [code generated]

ERROR in /Users/juanbasso/tmp/webpack5/hello-world-no-class/src/App.vue.ts
3:21-30
[tsl] ERROR in /Users/juanbasso/tmp/webpack5/hello-world-no-class/src/App.vue.ts(3,22)
      TS2614: Module '"*.vue"' has no exported member 'HelloProp'. Did you mean to use 'import HelloProp from "*.vue"' instead?
ts-loader-default_0c5a263502dc9404

webpack 5.48.0 compiled with 1 error in 5039 ms

Steps to Reproduce the Problem

I created a sample to reproduce the working and not working versions:

To reproduce, simply checkout the branch and run npm ci && ./node_modules/.bin/webpack

Location of a Minimal Repository that Demonstrates the Issue.

See steps to reproduce.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions