menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Parcel

📦🚀 Blazing fast, zero configuration web application bundler

Channels
Team

Why are assets loaded more than once on initial startup?

November 16, 2018 at 12:47pm

Why are assets loaded more than once on initial startup?

November 16, 2018 at 12:47pm
Hi, I'm relatively new to Parcel and am working on my first plugin (tslinting TypeScript assets on load):
class MyAsset extends TypeScriptAsset {
async load() {
console.warn('Loading asset:', this.relativeName);
}
}
When I run Parcel (and my plugin), every .ts file in my project appears to be loaded twice (i.e., the console output is displayed twice:
$ npx parcel --no-cache src/index.html
Server running at http://localhost:1234
Loading asset: index.ts
Loading asset: foo.ts
✨ Built in 1.48s.
Loading asset: index.ts
Loading asset: foo.ts
The "asset is loaded twice" behavior is only on startup. After that, assets are only loaded once after behind modified.
Why is this happening? Does it have something to do with how the dependency tree is resolved for the first time on startup?
Note: If I run with PARCEL_WORKERS=1, the each asset is only loaded once on startup (console output is only displayed once per .ts file).

November 16, 2018 at 6:28pm
good point looks like its a bug

November 17, 2018 at 6:47pm
Created an issue and sample project for re-creating: https://github.com/parcel-bundler/parcel/issues/2294

November 18, 2018 at 3:58am

November 18, 2018 at 8:24pm