Importing classnames installed via NPM while using Webpack
See original GitHub issueHi, firstly i’d like to thank you and the comunity for this amazing module, it certainly makes the life of anyone coding in React easier.
It seems i’m doing something wrong, yet i cant find what it is. You see, i’m coding in React with Typescript, therefore, i use
import * as ClassNames from "classnames"
to import your module into my code, but webpack seems unable to include it in the output bundle, forcing me to include it as a separate asset in my html. While this isn’t terribly annoying, it would be wonderfull if classnames could be bunbled with the rest of my code.
I hope you can help me, either by telling what i’m doing wrong or by showing me how to hack around this. Thanks in advanced!!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:15
Top Results From Across the Web
classnames - npm
A simple JavaScript utility for conditionally joining classNames together. Install with npm, Bower, or Yarn: # via npm npm install ...
Read more >How to configure CSS Modules for webpack - LogRocket Blog
In this article, we will practice using CSS Modules with a webpack demo project in order to learn how to configure an app...
Read more >style-loader - webpack
It's recommended to combine style-loader with the css-loader ... component-with-css-modules.js ... All locals (class names) stored in imported object.
Read more >Installing an npm package and using it in TSX files
The error is saying that you're missing the classnames npm modue. react-super-select has it, along with lodash, in its peerDepedencies so ...
Read more >Using CSS in React and TypeScript with Webpack 5
css-loader reads the referenced CSS file in the import statement ( app.css in our example). style-loader then put this CSS content into a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top 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
Because there’s not really an “answer” on this thread, I wanted to supply the one that worked for me:
@ramarivera
I’m just curious, may I ask you to try this:
If that works, it is related to another bug I issued months ago: https://github.com/JedWatson/classnames/issues/82#issuecomment-218676799