Commit 1a9bf915 by Roman Misyurin Committed by Ryan McKinley

Toolkit: support less loader (#21527)

parent c5da1864
...@@ -95,7 +95,9 @@ ...@@ -95,7 +95,9 @@
"tslint-config-prettier": "^1.18.0", "tslint-config-prettier": "^1.18.0",
"typescript": "3.7.2", "typescript": "3.7.2",
"url-loader": "^2.0.1", "url-loader": "^2.0.1",
"webpack": "4.35.0" "webpack": "4.35.0",
"less": "^3.10.3",
"less-loader": "^5.0.0"
}, },
"_moduleAliases": { "_moduleAliases": {
"puppeteer": "node_modules/puppeteer-core" "puppeteer": "node_modules/puppeteer-core"
......
...@@ -4,7 +4,7 @@ import { getPluginId } from '../utils/getPluginId'; ...@@ -4,7 +4,7 @@ import { getPluginId } from '../utils/getPluginId';
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const supportedExtensions = ['css', 'scss']; const supportedExtensions = ['css', 'scss', 'less'];
const getStylesheetPaths = (root: string = process.cwd()) => { const getStylesheetPaths = (root: string = process.cwd()) => {
return [`${root}/src/styles/light`, `${root}/src/styles/dark`]; return [`${root}/src/styles/light`, `${root}/src/styles/dark`];
...@@ -114,6 +114,22 @@ export const getStyleLoaders = () => { ...@@ -114,6 +114,22 @@ export const getStyleLoaders = () => {
use: ['style-loader', ...cssLoaders, 'sass-loader'], use: ['style-loader', ...cssLoaders, 'sass-loader'],
exclude: [`${styleDir}light.scss`, `${styleDir}dark.scss`], exclude: [`${styleDir}light.scss`, `${styleDir}dark.scss`],
}, },
{
test: /\.less$/,
use: [
{
loader: 'style-loader',
},
...cssLoaders,
{
loader: 'less-loader',
options: {
javascriptEnabled: true,
},
},
],
exclude: [`${styleDir}light.less`, `${styleDir}dark.less`],
},
]; ];
return rules; return rules;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment