vue-flatpickr-component icon indicating copy to clipboard operation
vue-flatpickr-component copied to clipboard

SSR: failed to import component after upgrade to 11.0.4

Open phlegx opened this issue 1 year ago • 2 comments

I'm submitting a ... (check one with "x")

[x] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe

Tell about your platform

  • flatPickr version : 4.6.13
  • Vue.js version : 3.4
  • Browser name and version : Chrome|Firefox|Edge x.x.x
  • This package version : 11.0.4

Current behavior

After upgrade this package from 11.0.3 to 11.0.4 this error is thrown:

[vite] Error when evaluating SSR module /src/views/.../Index.vue: failed to import "vue-flatpickr-component"
|- ./node_modules/vue-flatpickr-component/dist/esm/index.js:1
import Component from './component';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (node:internal/modules/cjs/loader:1378:20)

Expected behavior

This package should work also for SSR environments (package vite-ssr).

Minimal reproduction of the problem with instructions

phlegx avatar Sep 04 '24 06:09 phlegx

Please provide more information

ankurk91 avatar Sep 04 '24 08:09 ankurk91

Possible causing PR https://github.com/ankurk91/vue-flatpickr-component/pull/286

ankurk91 avatar Sep 09 '24 01:09 ankurk91

I can confirm this issue. It it present in 11.0.4 and 11.0.5. 11.0.3 is unaffected.

It is 100% caused by #286.

Another user posted feedback in https://github.com/ankurk91/vue-flatpickr-component/pull/286#issuecomment-1953855027.

We use this repo in atk4/ui. We can build our JS (using webpack) fine, but eslint is unhappy (when upgraded from 11.0.3 to 11.0.4/11.0.5):

> eslint --ext .js,.vue .

/__w/ui/ui/js/src/Service/vueService.js
  86:96  error  Unable to resolve path to module 'vue-flatpickr-component'  import/no-unresolved

The repro code: https://github.com/atk4/ui/blob/b70a9200a79638da730cb2ce203a35407d2f3a70/js/src/Service/vueService.js#L86

mvorisek avatar Feb 07 '25 12:02 mvorisek

Also facing the same issue.

atymic avatar Mar 01 '25 22:03 atymic

i want a minimal reproduction of the issue

ankurk91 avatar Mar 03 '25 12:03 ankurk91

Downgrade to to 11.0.3 fixed for me as well

atymic avatar Mar 03 '25 22:03 atymic

i want a minimal reproduction of the issue

Here are steps to reproduce:

  1. checkout https://github.com/atk4/ui.git
  2. cd js/
  3. run npm install
  4. run eslint .
  5. run step 4 again with https://github.com/atk4/ui/blob/a40fb14c96/js/src/Service/vueService.js#L86 comment ignored and notice eslint cannot resolve the import in v11.0.4/11.0.5 (can be verified by downgrading to v11.0.3 and repeating steps 3 and 4)

mvorisek avatar Mar 03 '25 22:03 mvorisek

I said minimal

ankurk91 avatar Mar 04 '25 01:03 ankurk91

Here is minimal repro https://github.com/atk4/ui/tree/ankurk91--vue-flatpickr-component--repro-295.

Repro steps are described in https://github.com/ankurk91/vue-flatpickr-component/issues/295#issuecomment-2695712407. In our case, the issue is present when running eslint, webpack can resolve the import fine.

mvorisek avatar Mar 05 '25 12:03 mvorisek

Reverted changes and released v12

ankurk91 avatar Mar 14 '25 10:03 ankurk91