-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
TypeError on Import #121
Comments
What bundler are you using? |
Ah, so that must be my issue then? I'm not using a bundler. |
Ah! Wait, then how are you importing If ur using it raw in a browser environment, maybe using the CDN directly could be worth it? https://esm.sh/@neodrag/[email protected] |
I came up with a seperate solution to generate the UMD file using the Rollup compiler. Possibly it could make us of the NX package as well. It's just a first shot for now. // neodrag/packages/vanilla/rollup.config.js
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
const config = {
input: 'src/index.ts',
output: {
name: 'Draggable',
format: 'umd',
file: 'dist/index.js'
},
plugins: [ typescript(), commonjs(), resolve(), /* terser() */ ]
};
export default config; // package.json
"scripts": {
...
"compile:umd": "rollup --config"
} |
Hey! Sorry for the late reply. Regarding your problem, is there anything stopping you from using |
@PuruVJ I am embedding scripts directly on the page without a compiler. If I use the |
Ah! I'll add a UMD in that case |
Hey there,
First off, love this library! I'm using the vanilla version and I'm getting a type error after importing:
Uncaught TypeError: The specifier “@neodrag/vanilla” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.
I think it's an issue with the path. I solved this by changing
import { Draggable } from "@neodrag/vanilla";
toimport { Draggable } from "../node_modules/@neodrag/vanilla/dist/min/index.js";
Once I changed that my object became draggable!I've included a few screenshots of my test project below.
The text was updated successfully, but these errors were encountered: