naftis / craco-stylus Goto Github PK
View Code? Open in Web Editor NEWStylus support with modules for create-react-app & craco
License: ISC License
Stylus support with modules for create-react-app & craco
License: ISC License
I just found this repo today, and it's exactly what I need. However, I could not get it to work until I downgraded stylus-loader
to 3.x
.
Specifically:
node_modules/stylus-loader/dist/cjs.js??ref--5-oneOf-8-3!./src/styles/app.styl)
ValidationError: Invalid options object. Stylus Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'source'. These properties are valid:
object { stylusOptions?, sourceMap?, webpackImporter?, additionalData? }
I ended up copying the source code and editing it appropriately for the new docs: https://webpack.js.org/loaders/stylus-loader/
It works well when running "yarn start".
but when running build, it shows the error msg.
// craco.config.js
const CracoStylusPlugin = require('craco-stylus');
const path = require("path");
const resolve = dir => path.resolve(__dirname, dir);
module.exports = {
plugins: [
{
plugin: CracoStylusPlugin
}
],
webpack: {
alias: {
"@": resolve("src"),
"@common": resolve("src/common")
}
}
}
and here is my package.json
"dependencies": {
"@craco/craco": "^6.1.1",
"@reduxjs/toolkit": "^1.5.1",
"@types/lodash": "^4.14.168",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-redux": "^7.2.3",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-transition-group": "^4.4.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"typescript": "^4.2.3",
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3",
"@types/react-redux": "^7.1.16",
"@types/react-router-dom": "^5.1.7",
"@types/react-transition-group": "^4.4.1",
"@types/redux": "^3.6.0",
"@typescript-eslint/parser": "^4.19.0",
"craco-stylus": "^1.1.1",
"css-loader": "^4.3.0",
"eslint-config-react-app": "^6.0.0",
"mini-css-extract-plugin": "^1.4.0",
"stylus": "^0.54.8",
"stylus-loader": "^4.3.3"
}
I've tried several versions of 'mini-css-extract-plugin' and 'stylus-loader', none of them work. So could you please tell me how to solve this problem Or show your package.json file. Thx a lot!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.