analogjs / analog

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

New analog project could not compile #75

Closed KylerJohnsonDev closed 1 year ago

KylerJohnsonDev commented 1 year ago

Please provide the environment you discovered this bug in.

Apple Macbook M1 - local

Which area/package is the issue in?

Don't know / Other

Description

Steps to reproduce:

  1. Run yarn create analog analog-test
  2. navigate to analog-test directory
  3. run yarn to install dependencies
  4. Observe error

Note: I experienced the same issue using npm

I was able to solve this problem and successfully run the app after making two changes to the tsconfig.app.json:

  1. Add "src/*/.component.ts" to the includes array
  2. Changing the composite compiler option to false

I'm not sure if this is the optimal solution but but it got the project running.

Please provide the exception or error you saw

✘ [ERROR] [plugin angular-compiler] TS6304: Composite projects may not disable declaration emit.

✘ [ERROR] [plugin angular-compiler] TS6307: File '/Users/kjohnson/analog-test-2/src/app/app.component.ngtypecheck.ts' is not listed within the file list of project '/Users/kjohnson/analog-test-2/tsconfig.app.json'. Projects must list all files or use an 'include' pattern.

    src/app/app.component.ts:0:0:
      0 │
        ╵ ^

✘ [ERROR] [plugin angular-compiler] TS6307: File '/Users/kjohnson/analog-test-2/src/app/app.component.ts' is not listed within the file list of project '/Users/kjohnson/analog-test-2/tsconfig.app.json'. Projects must list all files or use an 'include' pattern.

    src/main.ts:5:29:
      5 │ import { AppComponent } from './app/app.component';
        ╵                              ~~~~~~~~~~~~~~~~~~~~~

error when optimizing deps:
Error: Build failed with 3 errors:
error: TS6304: Composite projects may not disable declaration emit.
src/app/app.component.ts:0:0: ERROR: [plugin: angular-compiler] TS6307: File '/Users/kjohnson/analog-test-2/src/app/app.component.ngtypecheck.ts' is not listed within the file list of project '/Users/kjohnson/analog-test-2/tsconfig.app.json'. Projects must list all files or use an 'include' pattern.
src/main.ts:5:29: ERROR: [plugin: angular-compiler] TS6307: File '/Users/kjohnson/analog-test-2/src/app/app.component.ts' is not listed within the file list of project '/Users/kjohnson/analog-test-2/tsconfig.app.json'. Projects must list all files or use an 'include' pattern.
    at failureErrorWithLog (/Users/kjohnson/analog-test-2/node_modules/vite/node_modules/esbuild/lib/main.js:1624:15)
    at /Users/kjohnson/analog-test-2/node_modules/vite/node_modules/esbuild/lib/main.js:1266:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


### Other information

Node version: 16.15.1
Yarn version: 1.22.19
Npm versions: 8.11.0

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

- [X] Yes
- [ ] No
KylerJohnsonDev commented 1 year ago

Running the vite optimize post install script produces this error. Here is a link to a github repo with my analog project. The main branch contains no changes so you should see the above errors.

This is a PR into my main branch showing what I changed in order to compile and run the app.

brandonroberts commented 1 year ago

My guess it was this PR that caused it. https://github.com/analogjs/analog/pull/65