Skip to content

Commit

Permalink
refactor: compatible with esm less plugins (#1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript authored May 14, 2024
1 parent bdfbeee commit a7ce038
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/mako/src/lessLoader/lessLoader.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ const lessLoader = {

const pluginInstances: Less.Plugin[] | undefined = plugins?.map((p) => {
if (Array.isArray(p)) {
const pluginClass = require(p[0]);
return new pluginClass(p[1]);
const pluginModule = require(p[0]);
const PluginClass = pluginModule.default || pluginModule;
return new PluginClass(p[1]);
} else {
return require(p);
}
Expand Down

0 comments on commit a7ce038

Please sign in to comment.