rollup-plugin-postcss icon indicating copy to clipboard operation
rollup-plugin-postcss copied to clipboard

Use @import (reference) '~moduleName/file.less'

Open frodehansen2 opened this issue 5 years ago • 4 comments

I import npm modules from a monorepo, which uses the syntax "@import (reference) '~moduleName/less/vaiables.less' to import less variables. But when I try to build, i get the (postcss plugin) Error: '~moduleName/less/variables' wasn't found."

I see the ~ is available for sass files, but it is not for less files? Or is there some config I can set to make this work?

frodehansen2 avatar Dec 18 '19 08:12 frodehansen2

the same question

ywy94ywy avatar Feb 22 '20 07:02 ywy94ywy

The same question

bentrynning avatar May 06 '20 19:05 bentrynning

@frodehansen2 have you solve the question?

zx930626 avatar Aug 14 '20 08:08 zx930626

you can figure out like this:

import NpmImport from 'less-plugin-npm-import'; import postcss from 'rollup-plugin-postcss';

export default { ...... plugins: [ postcss({ use: [['less', { plugins: [new NpmImport({prefix: '~'})], }]], }), ] }

tuotuodev avatar Oct 19 '20 06:10 tuotuodev