Comments (9)
Thank you. It is indeed our own configuration issue and I aplogize. We had: condition "include: **/*.js" to make sure it is only injected into JS files (it tries to insert into scss otherwise), however that mapping doesn't work with node_modules then and was then not injecting it properly. Will adjust it accordingly
from jqtree.
Or rather, even a proper wrapper fixed it for me (copied from a library that works with vite
command):
;(function ($, window, document, undefined) {
...
})( jQuery, window, document );
from jqtree.
I'll have look
from jqtree.
I tried to use Vite js with jqTree and it works. See https://github.com/mbraak/vite-jqtree-demo
I didn't make any changes to jqTree.
from jqtree.
Unfortunately I must re-open this case. It seemed to work since I was probably only testing it in development mode, which it did not work before due to my own error (previous error was about missing jquery). However, if I run vite build
/npm run build
, then it throws error about "require is not defined":
app-d21daea4.js:15 Uncaught ReferenceError: require is not defined
at app-d21daea4.js:15:15490
at app-d21daea4.js:1:23
at app-d21daea4.js:17:17925
...
Yt.JqTreeWidget = void 0;
var Bs = Me(require("./version")) <-
If I run vite
/npm run dev
then it works.
I am made a sample barebone Laravel project: https://github.com/TivoSoho/laravel-jqtree There is essentially nothing there, but we use it in laravel context in case it matters. This is the config:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import inject from "@rollup/plugin-inject";
export default defineConfig({
plugins: [
inject({
$: 'jquery',
jQuery: 'jquery',
}),
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
],
});
and this is the app.js:
import './bootstrap';
import $ from 'jquery';
window.$ = $;
window.jQuery = $;
import 'jqtree';
Any suggestions as to what I might be doing wrong, what is missing for it to work?
from jqtree.
I made a branch in the jqtree
repository with a fix: #739
In my vite project I changed the jqtree dependency to:
"jqtree": "https://github.com/mbraak/jqTree.git#change-bundle-in-package"
Can you check if this works for you? It works in my test project.
from jqtree.
The fix is included the latest release
from jqtree.
There is still an issue when the jquery versions are different. I'm working on a pr.
from jqtree.
The issue with the different jquery versions is fixed in version 1.7.3
from jqtree.
Related Issues (20)
- What can I do if I choose only child multiple times HOT 6
- How to export and import jqTree data? HOT 9
- Rename selected node HOT 3
- Autoscroll - top level dragged item no scroll over the items under it. HOT 20
- Behavior changed with 1.7.0 HOT 3
- Set jQuery as a peer dependency
- Fix eslint import error
- Is documentation page dead? HOT 4
- Inconsistent/incorrect drag & drop node highlighting HOT 9
- New root node missing icon HOT 3
- AddToSelection doesn't seem to use "mustSetFocus" HOT 4
- How to use jqTree with jQuery latest version 3.7.1 in ASP.NET HOT 4
- getPreviousNode() behaves differently HOT 4
- changed documentation? HOT 2
- function onCanMoveTo can't be override HOT 2
- Drag & Drop multiple nodes HOT 4
- Injection vulnerability because of lodash.template HOT 3
- The tree is not rendered, nothing happens.
- ContextMenuEvent HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jqtree.