Skip to content

Commit

Permalink
Merge branch 'main' into fb-master
Browse files Browse the repository at this point in the history
  • Loading branch information
ma101an authored May 2, 2022
2 parents a75938b + 7519045 commit f577d39
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
33 changes: 32 additions & 1 deletion packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const cssRegex = /\.css$/;
const cssModuleRegex = /\.module\.css$/;
const sassRegex = /\.(scss|sass)$/;
const sassModuleRegex = /\.module\.(scss|sass)$/;
const lessRegex = /\.less$/;

const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
Expand Down Expand Up @@ -115,7 +116,7 @@ module.exports = function (webpackEnv) {
const shouldUseReactRefresh = env.raw.FAST_REFRESH;

// common function to get style loaders
const getStyleLoaders = (cssOptions, preProcessor) => {
const getStyleLoaders = (cssOptions, preProcessor, preProcessorOptions = {}) => {
const loaders = [
isEnvDevelopment && require.resolve('style-loader'),
isEnvProduction && {
Expand Down Expand Up @@ -188,6 +189,7 @@ module.exports = function (webpackEnv) {
{
loader: require.resolve(preProcessor),
options: {
...preProcessorOptions,
sourceMap: true,
},
}
Expand Down Expand Up @@ -584,6 +586,35 @@ module.exports = function (webpackEnv) {
'sass-loader'
),
},
// Adds support for Less (using .less extensions)
{
test: lessRegex,
use: getStyleLoaders(
{
importLoaders: 3,
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
modules: {
mode: 'icss',
},
},
'less-loader',
{
lessOptions: {
javascriptEnabled: true,
modifyVars: {
'@primary-color': '#722ed1'
},
}
}
),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github.com/webpack/webpack/issues/6571
sideEffects: true,
},
// "file" loader makes sure those assets get served by WebpackDevServer.
// When you `import` an asset, you get its (virtual) filename.
// In production, they would get copied to the `build` folder.
Expand Down
10 changes: 6 additions & 4 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "react-scripts",
"version": "5.0.1",
"name": "@growfin/react-scripts",
"version": "5.0.0",
"description": "Configuration and scripts for Create React App.",
"repository": {
"type": "git",
"url": "https://github.com/facebook/create-react-app.git",
"url": "https://github.com/sinecycle/create-react-app.git",
"directory": "packages/react-scripts"
},
"license": "MIT",
"engines": {
"node": ">=14.0.0"
},
"bugs": {
"url": "https://github.com/facebook/create-react-app/issues"
"url": "https://github.com/sinecycle/create-react-app/issues"
},
"files": [
"bin",
Expand Down Expand Up @@ -53,6 +53,8 @@
"jest": "^27.4.3",
"jest-resolve": "^27.4.2",
"jest-watch-typeahead": "^1.0.0",
"less": "^4.1.2",
"less-loader": "^10.2.0",
"mini-css-extract-plugin": "^2.4.5",
"postcss": "^8.4.4",
"postcss-flexbugs-fixes": "^5.0.2",
Expand Down

0 comments on commit f577d39

Please sign in to comment.