Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using requirejs.undef call seems to break this lib #10

Open
ORESoftware opened this issue Aug 28, 2015 · 2 comments
Open

using requirejs.undef call seems to break this lib #10

ORESoftware opened this issue Aug 28, 2015 · 2 comments

Comments

@ORESoftware
Copy link

hey there!

I tried Carvalho's jsx library and yours, and both seem to fail in a particular case and I am trying to figure out why.

I am trying to enable hot reloading with RequireJS, and using requirejs.undef seems to be the way to go.

I am able to get the hot reloading / hot swapping to work with RequireJS for .html files, and next up is JavaScript files.

The problem I have seems to boil down to this:

require(['jsx!one.js'],function(one){

//no problems

});

but when I want to reload a module like so, I get problems:

require.undef('jsx!one');

require([jsx!one.js],function(one){  //this line fails

//now we have problems, I get the classic React error: "SyntaxError: expected expression, got '<'"
//so it seems that the jsx transformer is not being reinvoked upon "reloading" the same file

});

I really am not sure why this is happening, but I do strongly believe that the jsx plugin and / or JSXTransformer is not being re-invoked when the same file is reloaded.

Does this make any sense? Do you think you could help me investigate while the JSXTransformer is not being re-invoked upon reloading a file with require([]) ?

@ORESoftware ORESoftware changed the title using requirejs.undef call seems to invalidate this libr using requirejs.undef call seems to invalidate this lib Aug 28, 2015
@ORESoftware ORESoftware changed the title using requirejs.undef call seems to invalidate this lib using requirejs.undef call seems to break this lib Aug 28, 2015
@ORESoftware
Copy link
Author

and here's the rub:

whereas the above with require fails, using define works!

             require.undef('jsx!two');
             define(['jsx!two'],function(file){
                    cb(null,file);
              });

so there seems to be some difference between require and define that I am missing

@ORESoftware
Copy link
Author

the following link to a project serves as an example as to the problems I am having using JSXTransformer with this library and RequireJS https://github.com/ORESoftware/requirejs-jsx-example/tree/master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant