Adding aurelia-ui-virtualization to Aurelia + WebPack

I’ve got a project that I started with the aurelia dotnet template.

dotnet new aurelia -ht:http2 -e:none -op:false

Now I’m trying to add aurelia-ui-virutalization. I started with
npm install aurelia-ui-virtualization --save

Package.json now shows dependencies: { ...,"aurelia-ui-virtualization" : "^1.0.0-beta.7"}.

I then edited main.js and added .plugin('aurelia-ui-virtualization') to aurelia.use.

At this point, if I compile and run my app, I get the following browser error in aurelia-loader-webpack.js:

Uncaught (in Promise) Error: Unable to find module with ID: aurelia-ui-virtualization

Can someone help me understand what I’m missing?

1 Like

If you are using WebPack you may need to import { PLATFORM } from 'aurelia-pal'; and then aurelia.use.plugin(PLATFORM.moduleName('aurelia-ui-virtualization')) instead.

See https://aurelia.io/docs/plugins/virtualization#configuring-the-plugin

3 Likes

Thanks so much! That was the problem.

1 Like