I am running 'npm test' on my app that is using an older version of the starter kit and am getting an error "Module Build Failed. ModuleBuildError". I am using CSS modules and the error messages reference my scss files that I import into my component JS, which works fine outside of tests. Here is one of the many errors I am receiving before the karma server starts:
ERROR in ./~/css-loader?sourceMap&-minimize&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/sass-loader?sourceMap!./~/toolbox-loader!./~/react-toolbox/lib/animations/slide-right.scss
Module build failed: Error: ENOENT: no such file or directory, open '/Users/.../<project_name>/theme.scss'
And this is the error I am receiving after the karma server and Phantom JS browser start:
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
Error: Cannot find module "./EmptyState.scss"
at webpack:///src/components/EmptyState/EmptyState.js:9:0 <- tests/test-bundler.js:76202
import { push } from 'react-router-redux'
followed by const { dispatch } = this.context.store
and then push it via dispatch(push('/company'))
?
src/routes/Thing/routes/SubThing
). I'm trying to create a nested route (with components and whatnot) but am not quite sure how to wire it up with the rest of the app (Not sure what SubThing/index.js
should look like)
@mrweissx_twitter cool thanks! I got the sub-route routing working with the changes to the MySubRoute/index.js
but still scratching my head getting the subroutes component "props" set.
I have the same dir layout (/modules /containers/ /modules index.js
) inside the sub-route directory (/src/routes/MyRoute/routes/MySubRoute/....
) but I'm not seeing the props
in the Component class being set, which I would have expected due to the call to connect
in src/routes/MyRoute/routes/MySubRoute/containers/MySubRouteContainer.js
.
@mrweissx_twitter I've been playing around with it a bit but can't seem to get the functionality I expect.
I'm using console.log(props, this.props)
from the sub-routes component constructor (class defined component) but am seeing only empty objects. The sub-routes index.js
is basically the same as the demo and other (with the exception that it's nested).
I've thrown console.log
s throughout and have confirmed that the route logic is being called (like the call to connect()
and I even see the reducer and state update in the Redux
dev tools, I just can't seem to get the injection of the props
into the sub-route component working in the same way the top level routes work.
@neverfox thanks for your reply! I have tried to solve that by Assign the two objects like this:
export function selectCustomer(id) {
return (dispatch) => {
return fetch(`/api/customer/get/${id}`, {method: 'get'}).then((response) => {
if (response.ok) {
return response.json().then((json) => {
dispatch(fetchCustomerAddons(id)).then((response) => {
!response.error ? (
response.payload.data != null ? (
json = Object.assign(json, response.payload.data),
dispatch({type: SELECT_CUSTOMER, customer: json})
) : dispatch({type: SELECT_CUSTOMER, customer: json})
) : ''
})
})
}
})
};
}
Is that an good (and fast way) to do this?