You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -12,33 +12,39 @@ It is recommended to use [babel-plugin-transform-modules](https://www.npmjs.com/
12
12
13
13
Before use, the plugin needs some configuration. Modify .babelrc:
14
14
15
-
- webpack 1.x
16
-
```json
17
-
{
18
-
"plugins": ["transform-modules", {
19
-
"cube-ui": {
20
-
"transform": "cube-ui/lib/${member}",
21
-
"kebabCase": true,
22
-
"style": true
23
-
}
24
-
}]
25
-
}
26
-
```
27
-
- webpack 2+
28
-
```json
29
-
{
30
-
"plugins": ["transform-modules", {
31
-
"cube-ui": {
32
-
"transform": "cube-ui/src/modules/${member}",
33
-
"kebabCase": true
34
-
}
35
-
}]
36
-
}
37
-
```
15
+
```json
16
+
{
17
+
"plugins": ["transform-modules", {
18
+
"cube-ui": {
19
+
"transform": "cube-ui/lib/${member}",
20
+
"kebabCase": true,
21
+
"style": true
22
+
}
23
+
}]
24
+
}
25
+
```
26
+
27
+
If not using babel-plugin-transform-modules, you need to import corresponding style files by hand:
28
+
29
+
```js
30
+
import'cube-ui/lib/style.css'
31
+
```
38
32
39
-
> [why distinguishs the version of webpack?](#/en-US/docs/post-compile)
33
+
**Notice:** By default cube-ui will use [post-compile](#/en-US/docs/post-compile) with webpack 2+, but post-complie needs some dependencies and configuration. If you don't want to use post-compile, just modify the webpack config file:
40
34
41
-
If not using babel-plugin-transform-modules, you need to import corresponding style files by hand.
Since cube-ui will use [post-compile](#/en-US/docs/post-compile) with webpack 2+ by default, your application's webpack and babel configuration needs to be compatible with cube-ui.
125
+
126
+
Follow the steps below:
127
+
128
+
1. Modify package.json
129
+
130
+
```json
131
+
{
132
+
// webpack-post-compile-plugin depends on compileDependencies
133
+
"compileDependencies": ["cube-ui"],
134
+
"devDependencies": {
135
+
// add stylus dependencies
136
+
"stylus": "^0.54.5",
137
+
"stylus-loader": "^2.1.1",
138
+
"webpack-post-compile-plugin": "^0.1.2"
139
+
}
140
+
}
141
+
```
142
+
143
+
2. Modify .babelrc:
144
+
145
+
```json
146
+
{
147
+
"plugins": ["transform-modules", {
148
+
"cube-ui": {
149
+
"transform": "cube-ui/src/modules/${member}",
150
+
"kebabCase": true
151
+
}
152
+
}]
153
+
}
154
+
```
155
+
156
+
3. Modify webpack.base.conf.js
157
+
158
+
```js
159
+
var PostCompilePlugin =require('webpack-post-compile-plugin')
160
+
module.exports= {
161
+
// ...
162
+
plugins: [
163
+
// ...
164
+
newPostCompilePlugin()
165
+
]
166
+
// ...
167
+
}
168
+
```
169
+
170
+
4. Modify `exports.cssLoaders` function in build/utils.js
0 commit comments