felipecrv / jsx-requirejs-plugin

A RequireJS plugin for loading and compiling (with r.js) JavaScript files containing JSX.
MIT License
270 stars 44 forks source link

r.js build fails on 'ReferenceError: document is not defined' #26

Closed jonira closed 10 years ago

jonira commented 10 years ago

used JSXTransformer 0.11.2 and r.js build fails with error message:

{ [ReferenceError: document is not defined]
     moduleTree:
      [ 'JSXTransformer',
        'jsx',
jonira commented 10 years ago

Workaround for now was to use: https://github.com/podio/requirejs-react-jsx

victor-homyakov commented 10 years ago

Could you give more details (version of r.js and text.js, build file, stack trace)? I am using r.js 2.1.11, text.js 2.0.12, and my builds are working with JSXTransformer since 0.11.0.

felipecrv commented 10 years ago

@jonira everything's working fine here:

$ node r.js -o build.js

Tracing dependencies for: main

Tracing dependencies for: react

Tracing dependencies for: JSXTransformer

Tracing dependencies for: text
Uglifying file: /Users/felipe/code/jsx-requirejs-plugin/build_js/JSXTransformer-0.11.2.js
Uglifying file: /Users/felipe/code/jsx-requirejs-plugin/build_js/jsx.js
Uglifying file: /Users/felipe/code/jsx-requirejs-plugin/build_js/main.js
Uglifying file: /Users/felipe/code/jsx-requirejs-plugin/build_js/react-with-addons-0.11.2.js
Uglifying file: /Users/felipe/code/jsx-requirejs-plugin/build_js/require.js
Uglifying file: /Users/felipe/code/jsx-requirejs-plugin/build_js/text.js

main.js
----------------
jsx.js
jsx!components/Timer
main.js
jonira commented 10 years ago

Thank you for the reply. I'll now close this issue.

@victor-homyakov Unfortunately, I cannot publish more info about source. Used versions are: r.js 2.1.14, text 2.0.12

@philix I can succesfully run the r.js for https://github.com/philix/jsx-requirejs-plugin/tree/master/js so I can only conclude that there is something wrong with my project files or build configuration.

This is a quite large existing project where handlebars templates are being replaced by react/JSX. For time being, I won't investigate this further.

jonira commented 10 years ago

Seems like this is issue in build configuration or project, not in jsx-require-plugin itself.