Skip to content
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

Anyone knows how to use jstree with webpack, thanks ? #1675

Closed
imjamespond opened this issue Dec 27, 2016 · 6 comments
Closed

Anyone knows how to use jstree with webpack, thanks ? #1675

imjamespond opened this issue Dec 27, 2016 · 6 comments
Labels

Comments

@imjamespond
Copy link

i try to import jstree.js in webpack project but i got this error
Uncaught ReferenceError: _typeof is not defined

@vakata vakata added the support label Dec 28, 2016
@vakata
Copy link
Owner

vakata commented Dec 28, 2016

Sorry, I can't help you, but judging from the error message I doubt this is an issue with jstree itself. I will bundle it with webpack in a few days - I will let you know if there were any issues I had to solve.

@vakata vakata closed this as completed Dec 28, 2016
@imjamespond
Copy link
Author

thanks, i have solved this problem by importing jstree installed from npm and this error disappear. while before i import the source code directly

@ReynerHL
Copy link

ReynerHL commented Aug 9, 2017

Does anyone have an example for use jstree with webpack ?? :(

@ReynerHL
Copy link

ReynerHL commented Aug 9, 2017

@imjamespond can you provide some code examples please? After imported as a npm module in a VueJS project, it seems to fail registration with jQuery. Calling $('#myTreeDomEl').jstree({"..."}); falls in a error telling us that jstree is not a function.

@imjamespond
Copy link
Author

maybe you didn't register jstree properly, and these code works fine for me
npm install --save jquery jstree
in webpack.config.js
new webpack.ProvidePlugin({
$ : "jquery",
jQuery : "jquery",
"window.jQuery" : "jquery"
})
]
....
import 'jstree';
$('#jstreeDiv').jstree({"plugins" :{"dnd", "search", "state", "types", "wholerow"}....

@auspex
Copy link

auspex commented Feb 15, 2019

This is still an issue, though not directly related to jstree. It's caused by babel, so won't be an issue if you're not using babel as well as webpack. It popped up in a completely unrelated tool: mapbox/mapbox-gl-js#3422

The fix is to add exclude: /jstree/ to the babel-loader options:

                    loader: 'babel-loader', options: {
                    	exclude: /jstree/,
                    	...
                    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants