Comments (12)
same issue
from customize-cra.
+1
from customize-cra.
+1
from customize-cra.
+1
from customize-cra.
+1
from customize-cra.
+1
from customize-cra.
from customize-cra.
+1
from customize-cra.
Duplicate of #315
from customize-cra.
+1
from customize-cra.
same issue
from customize-cra.
我也出现了这种现象,原本 customize-cra 的配置 如下
const { addLessLoader } = require("customize-cra");
const addLessConfig = () => {
return [
addLessLoader({
javascriptEnabled: true,
additionalLoaders: ["less-loader"],
cssModules: {
localIdentName:
process.env.NODE_ENV === "development"
? "[path][name]__[local]--[hash:base64:5]"
: "[sha512:hash:base64:7]",
},
}),
];
};
module.exports = addLessConfig;
解决方式是引入了一个新的库 customize-cra-less-loader
看这个库的介绍,是专门为 react-scripts version >= v5.0.0
使用的,因为 react-scripts
依赖的 webpack
是 V5 版本
升级 less less-loader
npm i -D customize-cra-less-loader less less-loader
const addLessLoader = require("customize-cra-less-loader");
const addLessConfig = () => {
return [
addLessLoader({
lessLoaderOptions: {
lessOptions: {
javascriptEnabled: true,
additionalLoaders: ["less-loader"],
cssModules: {
localIdentName:
process.env.NODE_ENV === "development"
? "[path][name]__[local]--[hash:base64:5]"
: "[sha512:hash:base64:7]",
},
},
},
}),
];
};
module.exports = addLessConfig;
再运行的时候就成功了,可以参考一下
from customize-cra.
Related Issues (20)
- __webpack_require__(...) is not a function
- CRA v4 switch from GenerateSW to InjectManifest not supported - workaround
- Is this project unmaintained? anybody here? HOT 1
- Example of "addWebpackExternals" has a error HOT 1
- 啥时候更新webpack5
- how can I prevent build/service-worker.js from being generated. I don't want any caching. please help, urgent
- add graphql loader
- Incompatible with Create-React-App 5.0: Invalid Options for PostCSS Loader HOT 8
- PostCSS plugin autoprefixer requires PostCSS 8.
- options has an unknown property 'plugins' HOT 1
- useEslintRc ERROR!! HOT 1
- addWebpackExternals: react is not defined HOT 2
- Using customizers for jest configuration HOT 3
- addPostcssPlugins doesn't work when react-scripts's version higher than or equal to 5.0.0 HOT 5
- setWebpackPublicPath auto option HOT 1
- Workbox strategies uncaught no-response
- TypeError: addWebpackPlugin is not a function
- react项目:在configoveride.js中addPostcssPlugins添加postcss-pxtorem无效 HOT 7
- getBabelLoader().options is undefined when you fix babel-loader
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from customize-cra.