Closed bewards closed 2 years ago
Oh damn, this must be caused by https://github.com/flekschas/svelte-simple-modal/commit/17663ad36c33c6292f442cce4518a414c64a80d4
Thanks for bringing this up!
I had to set up my local the following way to get it to work:
gulp
rollup({
input: "app/scripts/main.ts",
plugins: [
rollupPluginSvelte({
// Tell the svelte plugin where our svelte files are located
include: [
'app/**/*.svelte',
'node_modules/svelte-simple-modal/src/*.svelte',
],
Modal.svelte
import Modal, { bind } from 'svelte-simple-modal/src/Modal.svelte';
Yeah the problem is the missing export of bind
which I removed to get sveld
to work.
Also worth noting that importing bind in a normal typescript file (to use as a store) has the same error as the demo and my above solution doesn't work for non-svelte files
ModalStore.ts
import { writable } from 'svelte/store';
import { bind } from 'svelte-simple-modal';
const modal = writable(null);
export const showGlobalModalWithComponentProps = (component: any, props: Record<string, any>) => {
return modal.set(bind(component, props));
}
Is there anything I can do locally to get this working, such as copying the bind function? Or are there pieces of that that rely on the the svelte file?
You can use the previous version (v1.3.1). It contains a TypeScript error but you can ignore that error.
I just pushed a fix to master
. Could do me a favor and test if the latest version of master
works for you?
Trying to install master via npm with the following command but it's not working:
npm install --save flekschas/svelte-simple-modal#master --force
I'll download manually and check
You can also try the following:
git clone https://github.com/flekschas/svelte-simple-modal
cd svelte-simple-modal
npm install
npm build
npm pack
cd ../<your-application>
npm install ../svelte-simple-modal/svelte-simple-modal-1.3.2.tgz
@flekschas confirmed master works with bind - I just pulled down master and ran npm run build
with git bash to generate the lib/src/type folders and swapped those out with my local package.
Thanks for testing! New version (v1.3.3) is out. Could you double check that it works?
Confirmed v1.3.3, thank you @flekschas - this can be closed.
demo: https://svelte.dev/repl/aec0c7d9f5084e7daa64f6d0c8ef0209?version=3.48.0
I can also produce this locally using rollup.