-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem rendering tree #18
Comments
I'm running into the same problem. Using the boilerplate from https://github.com/davezuko/react-redux-starter-kit, and installed react-tree-menu into there. It seems that the common Webpack setup is to use babel-loader, configured to exclude /node_modules/, so it doesn't transpile JSX files left in libraries. Or something to that effect. Not sure if the react-tree-menu NPM package needs to include a pre-transpiled version to work right with Webpack, or what. Still getting used to the Webpack/NPM world, so I'm not sure I have a good answer for fixing things right now. |
I'll try and produce this later today or tomorrow. |
Yeah so it's probably what you said @markerikson ... I'm using the component in a webpack configuration like so:
Note that for |
I'm getting what I believe is a similar issue. Including my console logs as they are a little more detailed than the original poster's logs. (I shortened the file paths for readability) Console logs: -- and -- .../FrontEnd/node_modules/react-tree-menu/src/TreeMenu.jsx:57 SyntaxError: Unexpected token < |
I've got a workaround for this until this issue is resolved (it's not pretty, but it works):
Basically, this is just a manual transformation from JSX to JS. It doesn't take too long, as there isn't much JSX in those files. Hope this helps! |
i had the same problem with using webpack/redux and .js style files, but using what @MandarinConLaBarba said about the .jsx loader worked for me. thanks for the awesome component, saved me a lot of time! |
It still seems to be a problem. I've tried a few things but didn't manage to make this work with webpack. |
FWIW, I ran into this problem today and figured out that you just need to add another Your
Note: Instead of just one path that converts files found in |
I get the following error when trying to render a simple tree:
ERROR in ./
/react-tree-menu/src/TreeMenu.jsxModule parse failed: ..../node_modules/react-tree-menu/src/TreeMenu.jsx Line 57: Unexpected token <
You may need an appropriate loader to handle this file type.
|
| return (
|
| {this._getTreeNodes()}
|
@ .//react-tree-menu/index.js 1:10-39 3:15-44
Code:
import React, {Component} from 'react';
import TreeMenu, {TreeNode, Utils} from 'react-tree-menu';
export default class TreeSelector extends Component {
onTreeNodeClick() {}
onTreeNodeCollapseChange() {}
onTreeNodeCheckChange() {}
render() {
var data = [{
label : "Option 1"
},
{
label : "Option 2",
children : [
{
checkbox: true,
label: "Sub Option A",
children: [
{
label: "Third Level Nest Option 1",
checkbox : true
},
{
label: "Third Level Nest Option 2",
checkbox : true
}
]
},
{
checkbox: true,
label: "Sub Option B"
}
]
}];
}
}
The text was updated successfully, but these errors were encountered: