Less compiler in Meteor 3.0

My application uses less as a style file descriptor. When I try to compile it with Meteor 3, I get a package incompatibility error with Meteor 3. I took it locally, fixed the incompatibility, and tried to run the application again. Now I get a compile-time error for fewer files included in packages or on dynamically loaded contexts. From what I have determined, the problem occurs when trying to parse the file as if it were a javascript. Digging deeper, I noticed that the findImportedModuleIdentifiers function now no longer gets a format:

module.exports = require("meteor/modules").addStyles(\n  ".djs-context-pad .entry {\\n  width: 2rem !important;\\n}\\n.propertiespanel .ui.form .field .selectlist {\\n  min-width: 5rem !important;\\n  border-radius: 0 !important...

but the contents of the compiled less file, generating the error:

test2.less:1: Unexpected token (1:0)

The error occurs only if the less file contains at least one instance of the strings: “require”, “import”, “export”, “dynamicImport”, “link”, and is loaded in non-lazy mode.

So far this is blocking my ability to migrate, am I missing something?

After a bit of checking, I noticed that the instruction on line 741 of the compiler-plugin.js file does not take into account the fact that cssResource.data returns a Promise.

css = cssResource.data.toString("utf8");

I assume that this is an error that could produce the above result.

could @denyhs or someone else tell me if there is a fix for this?

Changing the line above to css = (await cssResource.data).... works.

Hi @denyhs could you please add this change in the next beta of Meteor 3?

In addition to this, there is an await missing in the formatEJSON function in the commands-packages-query.js file.


@pbeato, anyone can submit a PR to the meteor github repo. That can help expedite and ensure that these changes reach the build

Fixed some missing awaits and error dump at Mongo startup by plbkbx · Pull Request #13021 · meteor/meteor · GitHub and Changing the version of dependencies on the less package by plbkbx · Pull Request #13022 · meteor/meteor · GitHub.


Hi! I’m going to check this!

Merged your PRs @pbeato, thank you! They will be available in the next beta.