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.markdown
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,6 +163,24 @@ npm install brfs
163
163
then use `-t brfs` with the browserify command or use `.transform('brfs')` from
164
164
the browserify api.
165
165
166
+
# gotchas
167
+
168
+
Since `brfs` evaluates your source code *statically*, you can't use dynamic expressions that need to be evaluated at run time. For example:
169
+
170
+
```js
171
+
// WILL NOT WORK!
172
+
var file =window.someFilePath;
173
+
var str =require('fs').readFileSync(file, 'utf8');
174
+
```
175
+
176
+
Instead, you must use simpler expressions that can be resolved at build-time:
177
+
178
+
```js
179
+
var str =require('fs').readFileSync(__dirname+'/file.txt', 'utf8');
180
+
```
181
+
182
+
Another gotcha: `brfs` does not yet support ES2015 syntax like destructuring or `import` statements. See [brfs-babel](https://github.com/Jam3/brfs-babel) for an experimental replacement that supports this syntax.
0 commit comments