microbundle icon indicating copy to clipboard operation
microbundle copied to clipboard

LESS complie issue

Open Chris-LuYi opened this issue 3 years ago • 5 comments

I have encounter this error when try to compile my less file (postcss plugin) Error: Inline JavaScript is not enabled. Is it set in your options?

after exploring, find a solution to add config in my local microbundle file like below image

is there a way to config it through configuration?

Chris-LuYi avatar Jan 14 '21 05:01 Chris-LuYi

Hi @Chris-LuYi - I believe this should be possible by providing a postcss.config.js file, though I haven't tested it myself. Just as a heads-up, we're considering removing LESS support from Microbundle as part of an effort to focus on bundling npm modules. If you're using Microbundle to bundle a website, you might find wmr more suitable - it supports Rollup plugins, which should mean it's fairly straightforward to add a custom LESS processor.

developit avatar Jan 14 '21 15:01 developit

Hi @Chris-LuYi - I believe this should be possible by providing a postcss.config.js file, though I haven't tested it myself. Just as a heads-up, we're considering removing LESS support from Microbundle as part of an effort to focus on bundling npm modules. If you're using Microbundle to bundle a website, you might find wmr more suitable - it supports Rollup plugins, which should mean it's fairly straightforward to add a custom LESS processor.

Hi @developit , I tried add rollup.config and postcss.config in my project but seems not reading when run my microbuddle scirpt. Actually I am using microbuddle for my own package publishing, but it use antd which require less compliation, if I want to bundle my final application I can use wmr or webpack.

Chris-LuYi avatar Jan 15 '21 02:01 Chris-LuYi

Microbundle doesn't support custom Rollup configuration - allowing that would make it impossible to provide an upgradable preconfigured system.

FWIW there shouldn't be a reason to compile the less from antd just to use it as a dependency. It sounds like you might be inadvertently compiling antd into your module, which is generally not a desirable outcome since it leads to excessive duplication and breaks versioning. If your needs support it, I'd recommend listing antd in "dependencies", which will preserve imports for that library in bundled code rather than inlining all of it.

developit avatar Jan 15 '21 16:01 developit

Ya, by right I don't need to import LESS files from antd, because I am using the same less variable from antd try to make standard styling that's why I need it. Anyways thanks, I will figure another way to solve it.

On Sat, 16 Jan 2021 at 00:37, Jason Miller [email protected] wrote:

Microbundle doesn't support custom Rollup configuration - allowing that would make it impossible to provide an upgradable preconfigured system.

FWIW there shouldn't be a reason to compile the less from antd just to use it as a dependency. It sounds like you might be inadvertently compiling antd into your module, which is generally not a desirable outcome since it leads to excessive duplication and breaks versioning. If your needs support it, I'd recommend listing antd in "dependencies", which will preserve imports for that library in bundled code rather than inlining all of it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/developit/microbundle/issues/786#issuecomment-761047969, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFA6JAKOXJ3L23THERWG4B3S2BVMFANCNFSM4WB4T2MQ .

Chris-LuYi avatar Jan 17 '21 06:01 Chris-LuYi

Hi @Chris-LuYi - I believe this should be possible by providing a postcss.config.js file, though I haven't tested it myself. Just as a heads-up, we're considering removing LESS support from Microbundle as part of an effort to focus on bundling npm modules. If you're using Microbundle to bundle a website, you might find wmr more suitable - it supports Rollup plugins, which should mean it's fairly straightforward to add a custom LESS processor.

Can we support it using postcss.config.js ? I test it using the config file, but it doesn't work, seems microbundle OR postcss doesn't read the file.

dukeliberal avatar Aug 31 '21 10:08 dukeliberal