emmenko / redux-react-router-async-example

A showcase of the Redux architecture with React Router
http://emmenko.github.io/redux-react-router-async-example
MIT License
935 stars 131 forks source link

import * sentence for language files #53

Closed juanda99 closed 8 years ago

juanda99 commented 8 years ago

I'm developing a react app using https://github.com/davezuko/react-redux-starter-kit.

I'm studing your code for the localization. However I can't load json language files as you do (import * is awesome for this). I can see it works in your project but not in mine: http://stackoverflow.com/questions/34453020/import-doesnt-load-the-object-in-es6

Is it due to some webpack loader issue or some kind of extra configuration?

emmenko commented 8 years ago

The i18n files are js files, not json ;)

And yes, if you want to import json files you need a json loader for webpack.

Hope this helps you :)

juanda99 commented 8 years ago

Uuups, jsfiles yes. But import * not working as in your code. Maybe is an option in the transpiler... using babel6

emmenko commented 8 years ago

Make sure you have an index.js in your i18n folder which exports the single language files. Then import * from './i18n' should work. https://github.com/emmenko/redux-react-router-async-example/blob/babel-6/lib/i18n/index.js

juanda99 commented 8 years ago

It was due to a plugin. I reported the issue, thank you https://github.com/59naga/babel-plugin-add-module-exports/issues/20