Coder Social home page Coder Social logo

Comments (6)

zpao avatar zpao commented on April 19, 2024

Ok, so the problem is going to be how we register the transform. The big change in 0.8 was to switch to babel, which meant that we changed how we detected what needed to be transformed.

Specifically we now build up a regex and pass that into babel. AFAIK this was only tested on *nix so presumably we need to either build a better regex or there's bug in babel (I'm assuming it's our problem though).

I don't have a Windows machine super handy but this will hopefully be a pretty small fix. Would you or @gocreating be willing to help out and do a little bit of detective work to make the regex match what's being required? (might need to do options.settings.replace('\', '\\'), some logging of the regex being built and the filename should be enlightening)

from express-react-views.

gocreating avatar gocreating commented on April 19, 2024

@zpao excuse me, I am not familiar with regex and react, and I think I cannot help you in the meantime.
This is a great project, and I take it as part of my seed project :)

from express-react-views.

kohei-takata avatar kohei-takata commented on April 19, 2024

I use node-jsx and the error did not happen.

I run npm install node-jsx and added require('node-jsx').install(); above the router.

from express-react-views.

xuteng avatar xuteng commented on April 19, 2024

I got the same problem , To fix it ,I readed the Babel's docs and finded that the 'only' requires an array of glob paths, so I modified the index.js

var onlyArry = [];
  onlyArry.push(options.settings.views);
  moduleDetectRegEx = new RegExp('^' + options.settings.views);
  require('babel/register')({
    only: onlyArry
  });
  registered = true;

It fixed.

from express-react-views.

zpao avatar zpao commented on April 19, 2024

@xuteng - Hmm, http://babeljs.io/docs/usage/require/ indicates it takes a regex. And actually looking at the src (https://github.com/babel/babel/blob/master/src/babel/api/register/node.js#L154) it looks like both will work and it'll convert to an array and regex from that. So I think all that you're really doing is creating a regex without the leading ^.

Can you log what options.settings.views and filename are? My concern with leaving off part of the regex is that we'll inadvertently catch files outside the view path.

from express-react-views.

xuteng avatar xuteng commented on April 19, 2024

The options.settings.views and filename are:
image
Thank you for pointing out the mistake.
However the regex I got is (?:(?=.)d:\/(?=.)work\/(?=.)newWork\/(?=.)views) at last when passed an array at https://github.com/babel/babel/blob/master/src/babel/util.js#L99

from express-react-views.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.