PaulMaly / svelte-imask

IMask input component and action for Svelte 3
65 stars 1 forks source link

compile warning? #3

Closed cycle4passion closed 4 years ago

cycle4passion commented 4 years ago

When importing and using imask, why am I getting the error: 'imask' is imported from external module 'svelte-imask' but never used

import { imask } from "svelte-imask"; const smsOptions = {mask: "(000) 000-0000"}; <input type="tel" id="sms" bind:value={sms} name="sms" placeholder="(123) 456-7890" use:imask={smsOptions} />

PaulMaly commented 4 years ago

Hi! Strange, I can reproduce this warning in REPL. Are you sure your project set up correctly?

cycle4passion commented 4 years ago

I suspect it is something particular to Sapper, and yes Svelte v3 REPL works for me as well. So I did clean install sapper

npx degit "sveltejs/sapper-template#rollup" my-app
cd my-app
npm install
npm install --save svelte-imask
code .
-------------
// add to index.svelte

<script>
  import { imask } from "svelte-imask";
  const smsOptions = { mask: "(000) 000-0000" };
  let sms = "";
</script>

const smsOptions = {mask: "(000) 000-0000"}; 
<input type="tel" id="sms" bind:value={sms} name="sms" placeholder="(123) 456-7890" use:imask={smsOptions} />

//----------------- npm run dev

Server complains: src/routes/index.svelte changed. rebuilding... ✔ service worker (74ms) • server 'imask' is imported from external module 'svelte-imask' but never used ✔ client (859ms) ✔ service worker (19ms) ✔ service worker (7ms)

PaulMaly commented 4 years ago

Seems this issue not related to svelte-imask directly. So, I'll close it for now. Feel free to re-open if you'll get more details about it.