Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b8df916

Browse files
ro-savageAlexey Litvinov
authored and
Alexey Litvinov
committed
Updated readme for babel-node and ES6 import
1 parent abc2a05 commit b8df916

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@ require('css-modules-require-hook/preset');
5353
// const styles = require('./icon.css');
5454
```
5555

56+
57+
### Using with babel-node / ES6 Imports
58+
You will need to create a `cmrh.conf.js` file within the directory as you are importing `css-modules-require-hook`.
59+
60+
61+
```javascript
62+
// server.js
63+
import csshook from 'css-modules-require-hook/preset' // import hook before routes
64+
import routes from '/shared/views/routes'
65+
66+
// create server, etc
67+
```
68+
69+
```javascript
70+
// cmrh.conf.js
71+
module.exports = {
72+
// Same scope name as in webpack build
73+
generateScopedName: '[name]__[local]___[hash:base64:5]',
74+
}
75+
```
76+
77+
78+
5679
### Development mode
5780

5881
Usually, Node.js caches all the `require` calls by default. In order to invalidate cache for the purpose of development you should set the environment variable `NODE_ENV` to `development`. For example:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /