Open msimonc opened 6 years ago
yes i know this, just try after test: /.json$/, type: "javascript/auto",
in the rules of your web pack
This fixed the problem for me.
To clarify for the next person who arrives here from a Google search, type: "javascript/auto
is added to the redux-json-router/lib/route-loader
loader config in webpack.config.js
like this:
const routes = [path.resolve(__dirname, './path/to/routes.json')];
...
{
test: /\.json$/,
exclude: routes,
loader: 'json-loader',
},
{
test: /\.json$/,
type: "javascript/auto",
include: routes,
loader: 'redux-json-router/lib/route-loader',
options: {
...
}
},
...
i am also facing the same problem,howerver adding type: "javascript/auto"
creates a different issue,with htmlwebpackplugin
HtmlWebpackPlugin/Users/atishaybaid/Birdeye/UI-web-2.0/node_modules/toposort/index.js:29 throw new Error('Cyclic dependency: '+JSON.stringify(node)) TypeError: Converting circular structure to JSON at JSON.stringify (<anonymous>)
i tried upgrading toposort but this dosent solve my problem
Hi Michael,
Thanks for this,
If I upgrade my project to Webpack 4, on npm start I get:
ERROR in ./config/routes.json Module parse failed: Unexpected token e in JSON at position 0 You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token e in JSON at position 0 at JSON.parse ()
at JsonParser.parse (/Projects/NeighbourCare/react-starter-app/node_modules/webpack/lib/JsonParser.js:15:21)