What is hook.js and what is its benefits?
See original GitHub issueJust like I said, I read several starters and studied many implementations. I cannot understand what does the hooks.js
do?
I had no problem until installing tailwindcss
. By the docs guides, I add the require('tailwindcss'),
to the postcss.config.js
file and got this error:
/home/amerllica/WebstormProjects/heja/node_modules/css-modules-require-hook/node_modules/postcss/lib/lazy-result.es6:319
throw new Error(
^
Error: Use process(css).then(cb) to work with async plugins
at LazyResult.sync (/home/amerllica/WebstormProjects/heja/node_modules/css-modules-require-hook/node_modules/postcss/lib/lazy-result.es6:319:23)
at LazyResult.warnings (/home/amerllica/WebstormProjects/heja/node_modules/css-modules-require-hook/node_modules/postcss/lib/lazy-result.es6:157:21)
at fetch (/home/amerllica/WebstormProjects/heja/node_modules/css-modules-require-hook/lib/index.js:102:16)
at hook (/home/amerllica/WebstormProjects/heja/node_modules/css-modules-require-hook/lib/index.js:125:18)
at Object.cssModulesHook [as .css] (/home/amerllica/WebstormProjects/heja/node_modules/css-modules-require-hook/lib/attachHook.js:16:20)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/home/amerllica/WebstormProjects/heja/src/app/index.tsx:10:1)
[nodemon] app crashed - waiting for file changes before starting...
Then I look for the css-modules-require-hook
and I see a bad thing 🤦♂️ My GOD. this library is for 2 years ago.
Here are a few questions:
- what is
hooks.js
? - what does
hooks.js
do? - why reading the
postcss
configuration is not in the Webpack config? - what does
css-modules-require-hook
do? - what does
asset-require-hook
do? - is it possible to omit the
hooks.js
and add its configurations into Webpack config?
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (10 by maintainers)
Top Results From Across the Web
Introducing Hooks - React
With Hooks, you can extract stateful logic from a component so it can be tested independently and reused. Hooks allow you to reuse...
Read more >React Hooks and its Advantages - Board Infinity
React Hooks are a type of function that allows the users to hook into react state and life-cycle features from function components. React ......
Read more >Custom React JS Hooks: What Are They and When to Use ...
Custom React JS hooks offer three major benefits over standard library hooks: Reusability, readability, and testability. Reusability. Custom ...
Read more >React Hooks and its Advantages - DEV Community
Advantages of react hooks over class component : The main advantage of react hooks is the re-usability of stateful logic. It can be...
Read more >React Hooks — advantages and comparison to older reusable ...
hooks are easier to work with and to test (as separated functions from React components*) and make the code look cleaner, easier to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@theogravity
For tailwind, as my experience it’s easy to be integrated with this starter by following its documentation (see this issue). If you have any problem, please let me know, I’m glad to help you.
For
isopmorphic-style-loader
, I think we’re on the same page.@amerllica The
isomorphic-style-loader
can be one of the option. However I will find a way to eliminate thehook.js
after migrating webpack to v6. Let’s keep this issue for enhancement.