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
Copy file name to clipboardExpand all lines: README.md
+37-1Lines changed: 37 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Install the loader using [npm](https://npmjs.com/):
12
12
npm install --save ify-loader
13
13
```
14
14
15
-
You can then update your `webpack.config.js` in a similar fashion to the following to add browserify transform support to your project:
15
+
You can then update your `webpack.config.js` in a similar fashion to the following to add browserify transform support to your project's dependencies:
16
16
17
17
```javascript
18
18
module.exports= {
@@ -29,6 +29,42 @@ module.exports = {
29
29
}
30
30
```
31
31
32
+
### Using transforms in your project
33
+
34
+
Note that you're also free to apply this loader to files in your own project. Include the following in your project's `webpack.config.js`:
35
+
36
+
```javascript
37
+
module.exports= {
38
+
module: {
39
+
postLoaders: [
40
+
// support local package.json browserify config
41
+
{
42
+
test:/\.js$/,
43
+
loader:'ify'
44
+
}
45
+
]
46
+
}
47
+
}
48
+
```
49
+
50
+
Any browserify transforms you include in `package.json` will get picked up and applied this way:
51
+
52
+
```json
53
+
{
54
+
"name": "my-project",
55
+
"dependencies": {
56
+
"glslify": "5.0.0",
57
+
"brfs": "1.4.2"
58
+
},
59
+
"browserify": {
60
+
"transform": [
61
+
"glslify",
62
+
"brfs"
63
+
]
64
+
}
65
+
}
66
+
```
67
+
32
68
## Why?
33
69
34
70
When given the choice, I lean more in favour of [browserify](http://browserify.org) for its simplicity and compatability with node.js — however from time to time I need to work on projects that use webpack. The thing I run into issues with most often when switching between the two is the difference in how webpack handles source transforms compared to browserify.
0 commit comments