Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,17 @@ Then, add the loader to your `webpack` configuration. For example:
**file.js**

```js
import * as css from "file.css";
import * as css from "./file.css";
```

When using `css-loader`, importing a CSS file from JavaScript works because webpack processes the file through the loader pipeline and turns it into a JavaScript module.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove pipeline, and link to our docs page where loaders are documented.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


The imported value is not a native `CSSStyleSheet`. Instead, it is a JavaScript module generated by `css-loader`. When CSS Modules are enabled, the import can contain exported identifiers (such as class name mappings) from the CSS file.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases yes, so it is wrong


If you only want to apply the styles and do not need to access any exports, you can simply write:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesnt reference anything

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to reference imported module clearly


```js
import "./file.css";
Comment thread
evenstensberg marked this conversation as resolved.
```

**webpack.config.js**
Expand Down