vuejs / component-compiler-utils

Lower level utilities for compiling Vue single file components
319 stars 75 forks source link

TypeError: Class constructor LRUCache cannot be invoked without 'new' #79

Closed markuzzi closed 4 years ago

markuzzi commented 4 years ago

With LRUCache updated to version 5.1.1, the vue component compiler utils throw the error TypeError: Class constructor LRUCache cannot be invoked without 'new'

I think this is due to line 9 in lib/parse.ts:

const cache = require('lru-cache')(100)`;

If this would be changed to

const LRUCache = require('lru-cache');
const cache = LRUCache(100);

I think this would fix the problem.

Does it make sense?

sodatea commented 4 years ago

This project depends on lru-cache v4 at the moment. PR's welcome.

lenkog commented 4 years ago

PR: https://github.com/vuejs/component-compiler-utils/pull/83