aurelia: @parcel/core: Failed to resolve component

πŸ› Bug Report

I’ve created new, barebone Aurelia project using npx make aurelia. Project uses: TypeScript, SCSS and Parcel.

Following the tutorial for router-configuration, I modified/added following files main.ts

import { RouterConfiguration } from '@aurelia/router-lite';
import Aurelia from 'aurelia';
import { MyApp } from './my-app';

Aurelia
  .register(RouterConfiguration)
  .app(MyApp)
  .start();

my-app.ts

import { IRouteViewModel, route } from "aurelia";

@route({
  routes: [
    {
      path: ['', 'home'],
      component: import('./components/home-page'),
      title: 'Home',
    }
  ]
})
export class MyApp implements IRouteViewModel {
  public message = 'Hello World!';
}

my-app.html

<div class="message">${message}</div>
<au-viewport></au-viewport>

components/home-page.html

<h1>This is the home-page</h1>

components/home-page.ts

export class HomePage {
    
}

tsconfig.json

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "ES2022",
    "moduleResolution": "node",
    "skipLibCheck": true,
    "target": "ES2017",
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "sourceMap": true
  },
  "include": [
    "test",
    "src"
  ],
  "files": [
    "src/resource.d.ts"
  ]
}

πŸ€” Expected Behavior

I’m expecting site to run on http://localhost:9000 and to show content from home-page.html after the β€œHello World!” message.

😯 Current Behavior

Parcel shows error in command line:

> au-project-1@0.1.0 start
> parcel -p 9000

Server running at http://localhost:9000
Γ— Build failed.

@parcel/core: Failed to resolve 'b8fed70fb39c8137' from './src/my-app.ts'

  C:\Users\nvicentic\source\repos\aurelia2-projects\au-project-1\src\my-app.ts:7:25
    6 |       path: ['', 'home'],
  > 7 |       component: import('./components/home-page'),
  >   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^
    8 |       title: 'Home',
    9 |     }

🌍 Your Environment

Software Version(s)
Aurelia 2.0.0-alpha.29
Language TypeScript
Browser Any
Bundler : Parcel 2.5.0
Operating System Windows 11
NPM/Node/Yarn v16.14.0/8.3.1/1.22.18

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (12 by maintainers)

Commits related to this issue

Most upvoted comments

aurelia/new#84

Found a strange fix.

update .parcelrc from

"*.ts": ["@aurelia/parcel-transformer", "..."],

to

"*.ts": ["@aurelia/parcel-transformer", "@parcel/transformer-typescript-tsc"],

Could be related to this: https://parceljs.org/languages/typescript/#tsc

I will test more and update our skeleton.