web-react icon indicating copy to clipboard operation
web-react copied to clipboard

Issue on dev-server-client build

Open dfcarpenter opened this issue 10 years ago • 7 comments

Trying to figure out what is going wrong but keep getting an error on webpack build

 ERROR in ./app/routes.js
    Module build failed: Error: /Users/dan/Stringify/web-react/node_modules/eslint-loader/index.js!/Users/dan/Stringify/web-react/app/routes.js: Invalid mapping: {"generated":{"line":39,"column":21},"source":"/Users/dan/Stringify/web-react/node_modules/eslint-loader/index.js!/Users/dan/Stringify/web-react/app/routes.js","name":null}

dfcarpenter avatar Jul 14 '15 19:07 dfcarpenter

Weird, I can not figure out what is going on, so you can avoid it by including this at beginning and end:

Try into routes.js

/*eslint-disable*/
...code
/*eslint-enable*/

but it does not fix the problem, just escape some eslint checks.

can you share your routes.js

darul75 avatar Jul 14 '15 20:07 darul75

// LIBRARY
/*eslint-disable no-unused-vars*/
import React from 'react';
/*eslint-enable no-unused-vars*/
import {Route, DefaultRoute, NotFoundRoute} from 'react-router';

// COMPONENT
import Application from './components/App/App';
import Contact from './components/ContactSection/Contact';
import HomeSection from './components/HomeSection/HomeSection';
import NotFoundSection from './components/NotFoundSection/NotFoundSection';
import TodoSection from './components/TodoSection/TodoSection';

export default (
  <Route name='app' path='/' handler={Application}>
    <Route name='home' path='/home' handler={HomeSection}/>
    <Route name='todo' path='/todo' handler={TodoSection}/>
    <Route name='contact' path="/contact" handler={Contact}/>
    <DefaultRoute handler={HomeSection} />
    <NotFoundRoute handler={NotFoundSection} />
  </Route>
);

dfcarpenter avatar Jul 14 '15 20:07 dfcarpenter

hmm difficult, I have removed my node_modules folder, fetch modules again and I can not reproduce, looks like it is caused by sourcemap somewhere.

darul75 avatar Jul 14 '15 21:07 darul75

Found the problem

http://stackoverflow.com/questions/30983668/invalid-mapping-error-trying-to-use-babel-require-hook-and-polyfill-with-react

Tried latest version of acorn but that didn't work either so I had to explicitly put 1.0.3 for acorn jsx version in the package.json for babel-core and rm -rf node_modules/acorn-jsx && npm install in the node_modules/babel-core directory

dfcarpenter avatar Jul 15 '15 02:07 dfcarpenter

nice catch, what do you think I could do to resolve it ?

another question, does this project fits well your need, what should be improved ?

thx

darul75 avatar Jul 16 '15 14:07 darul75

  1. Since the build process works for you, I would try updating your babel-loader to the latest version and checking to see which version of acorn-jsx/acorn the babel-core dependency is using (Should be 2.0.4, I think). If it works for you then I would just update the package.json. Otherwise keep it the same and just add a caveat to readme.

2.I'm using this project as a test case by building an analytics app which queries elastic search. I am using a form in react to query elasticsearch (with an interface to elasticsearch as part of an api node exposes) and integrating d3 into the react components and displaying them on the screen. Once this works, I am looking into switching another app (our main front end app) from angular-es6/with jspm to isomorphic react/alt/immutable for performance gains. Mostly I am interested in the performance benefits of the isomorphic approach along with the developer ergonomics and maintainability of react along with a better understanding of the trend towards and benefits of immutable data types.

dfcarpenter avatar Jul 17 '15 18:07 dfcarpenter

hi @dfcarpenter

thank your for these details, I will update dependencies asap

to my mind flux approach combined with immutable data types avoid bad side effect.

some good reasons explained here by instance :

https://scott.mn/2014/04/27/why_immutable_collections/

darul75 avatar Jul 23 '15 17:07 darul75