I have a file MainContainer.jsx
in which I've written this code:
import React, { Component } from 'react'
/**
* Main Container, this will pass on all the Redux Store,
* Router references to child elements.
*/
class MainContainer extends Component {
/**
* React Lifecycle Method: Renders the data
*
* @return {DOM} Main container DOM.
*/
render() {
return (
<p>Hello world</p>
)
}
}
export default MainContainer
This is address to the file: app/containers/Main/MainContainer.jsx
I am trying to export
everything present in container
directory via index.js
file. Here is the content of the file:
export MainContainer from './Main/MainContainer'
I've set webpack alias
for containers
directory as $CONTAINERS
. Now I am trying to import MainContainer
like this:
import MainContainer from '$CONTAINERS' // no need to pass the MainContainer full path, as it's being exported from index.js
Now I am getting build error at index.js:
@ ./app/index.jsx 13:14-39
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server babel-polyfill ./app ./app/styles/main.css
ERROR in ./app/containers/index.js
Module build failed: SyntaxError: Unexpected token, expected { (1:7)
> 1 | export MainContainer from './Main/MainContainer'
| ^
2 |
@ ./app/config/routes.jsx 21:19-41
@ ./app/index.jsx
Does anybody know what am I missing here...