You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The release docs for 2.4.1 mention updates to exports in package.json. As I was updating django-tomselect to incorporate these changes, I noticed the tiny custom plugin we have, which uses getDom from vanilla, could not be updated to remove the deprecated src/ in the path. In fact, many plugins import various things from vanilla, but when various exports were added in 5979369, vanilla was not among them. This isn't an issue for the built-in plugins, because they use relative imports, but it is an issue for custom plugins.
The issue is that the exports section of package.json does not include vanilla.js
/** * Plugin: "dropdown_footer" (Tom Select) * Copyright (c) contributors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at: * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF * ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. * */import{getDom}from'tom-select/vanilla';typeDFOptions={title ?: string,footerClass ?: string,html ?: (data:DFOptions)=>string,};exportdefaultfunction(this:TomSelect,userOptions:DFOptions){constself=this;constoptions=Object.assign({title : 'Autocomplete Footer',footerClass : 'container-fluid mt-1 px-2 border-top dropdown-footer',html: (data:DFOptions)=>{return('<div title="'+data.title+'" class="'+data.footerClass+'"></div>');}},userOptions);self.hook('after','setup',()=>{varfooter=getDom(options.html(options));self.dropdown.appendChild(footer);});};
I am no JavaScript expert, so if I am misunderstanding something, or if there is a better approach than what I recommended here, please let me know.
The text was updated successfully, but these errors were encountered:
I don't think vanilla file will stay any longer. Many functions are just single line wrappers around native functions without any benefit. The remaining useful "utility" functions will move to tom-select/utils.
Meanwhile, you can still access it with an absolute path: tom-select/dist/esm/vanilla.js
Uh oh!
There was an error while loading. Please reload this page.
Bug description
The release docs for 2.4.1 mention updates to exports in
package.json
. As I was updatingdjango-tomselect
to incorporate these changes, I noticed the tiny custom plugin we have, which usesgetDom
from vanilla, could not be updated to remove the deprecatedsrc/
in the path. In fact, many plugins import various things fromvanilla
, but when various exports were added in 5979369,vanilla
was not among them. This isn't an issue for the built-in plugins, because they use relative imports, but it is an issue for custom plugins.The issue is that the
exports
section ofpackage.json
does not includevanilla.js
I recommend adding the following to exports, which worked perfectly on my local machine:
Expected behavior
Steps to reproduce
See above
Additional context
OS: Ubuntu 24.04
NPM (LTS)
tom-select ^2.4.1
For context, here is the
dropdown_footer
plugin:I am no JavaScript expert, so if I am misunderstanding something, or if there is a better approach than what I recommended here, please let me know.
The text was updated successfully, but these errors were encountered: