analogjs / analog

The fullstack meta-framework for Angular. Powered by Vite and Nitro
https://analogjs.org
MIT License
2.5k stars 240 forks source link

"default" is not exported by "virtual:angular:jit:template:file;button.component.html #383

Closed sand4rt closed 1 year ago

sand4rt commented 1 year ago

Please provide the environment you discovered this bug in.

Reproduction steps:

  1. clone the pr: https://github.com/sand4rt/playwright-ct-angular/pull/4/files
  2. install the packages: pnpm i
  3. run the tests: pnpm run test

Which area/package is the issue in?

vite-plugin-angular

Description

Playwright component testing throw's while compiling with the Vite plugin in JIT mode. I only see this error when templateUrl is used.

related to: https://github.com/analogjs/analog/pull/374

Please provide the exception or error you saw

ct-angular test: Running 42 tests using 6 workers
ct-angular test: vite v4.3.5 building for production...
ct-angular test: transforming...
ct-angular test: Error when using sourcemap for reporting an error: Can't resolve original location of error.
ct-angular test: ✓ 258 modules transformed.
ct-angular test: ✓ built in 5.64s
ct-angular test: "default" is not exported by "virtual:angular:jit:template:file;/playwright-ct-angular/ct-angular/src/components/button.component.html", imported by "src/components/button.component.ts".
ct-angular test: file: /playwright-ct-angular/ct-angular/src/components/button.component.ts:2:7
ct-angular test: 1: import { __decorate } from "tslib";
ct-angular test: 2: import __NG_CLI_RESOURCE__0 from "virtual:angular:jit:template:file;/playwright-ct...
ct-angular test:           ^
ct-angular test: 3: import { Component, EventEmitter, Input, Output } from '@angular/core';
ct-angular test: 4: let ButtonComponent = class ButtonComponent {
ct-angular test: RollupError: "default" is not exported by "virtual:angular:jit:template:file;/playwright-ct-angular/ct-angular/src/components/button.component.html", imported by "src/components/button.component.ts".

Other information

No response

I would be willing to submit a PR to fix this issue

brandonroberts commented 1 year ago

@sand4rt I tested this fix against your repository and confirmed it builds correctly now

sand4rt commented 1 year ago

@brandonroberts Thanks for the reply. Updated the vite plugin to 0.2.0-beta.7 (see the code change here) but i get the same error: https://github.com/sand4rt/playwright-ct-angular/actions/runs/4962939650/jobs/8881623460#step:8:21. Am i missing something?

goetzrobin commented 1 year ago

Once 0.2.0-beta.8 is released you should be able to see the code changes reflected in your project

brandonroberts commented 1 year ago

@analogjs/vite-plugin-angular@2.0.0-beta.8 has been published

sand4rt commented 1 year ago

@brandonroberts the error is gone but i got a new one: https://github.com/sand4rt/playwright-ct-angular/actions/runs/4982804611/jobs/8918991483#step:8:1

Also get a lot of warnings about source maps. Any idea?