Skip to content
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

date-fns-tz doesn't work with Histoire #761

Open
6 tasks done
did opened this issue Sep 12, 2024 · 0 comments
Open
6 tasks done

date-fns-tz doesn't work with Histoire #761

did opened this issue Sep 12, 2024 · 0 comments
Labels
to triage This issue needs to be triaged

Comments

@did
Copy link

did commented Sep 12, 2024

Describe the bug

I described the issue and the solution here: marnusw/date-fns-tz#299

When building my stories in a brand new Nuxt app embedding the date-fns-tz lib, I got this error:

Error while collecting story /Users/foo/hello-world/components/HelloWord.story.vue:
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/foo/hello-world/node_modules/date-fns-tz/dist/esm' is not supported resolving ES modules imported from /Users/foo/hello-world/node_modules/vite-node/dist/client.mjs
Did you mean to import "/Users/foo/hello-world/node_modules/date-fns-tz/dist/esm/index.js"?
    at finalizeResolution (node:internal/modules/esm/resolve:259:11)
    at moduleResolve (node:internal/modules/esm/resolve:933:10)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:390:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:359:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:322:34)
    at importModuleDynamically (node:internal/modules/esm/translators:160:35)
    at importModuleDynamicallyCallback (node:internal/modules/esm/utils:225:14)
    at ViteNodeRunner.importExternalModule (file:///Users/foo/hello-world/node_modules/vite-node/dist/client.mjs:357:5)
    ```
    
  The `viteNodeInlineDeps` trick didn't help.

### Reproduction

1. generate a brand Nuxt app
2. add the `date-fns-tz` lib
3. generate a component and its story
4. in the component, include `import { fromZonedTime } from 'date-fns-tz/fromZonedTime';` and use it in the code.
5. run `yarn story:build`

### System Info

```shell
System:
    OS: macOS 14.6.1
    CPU: (12) arm64 Apple M2 Pro
    Memory: 136.34 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.12.2/bin/yarn
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    pnpm: 9.1.3 - ~/.nvm/versions/node/v20.12.2/bin/pnpm
  Browsers:
    Safari: 17.6
  npmPackages:
    @histoire/plugin-nuxt: ^0.17.17 => 0.17.17 
    @histoire/plugin-vue: ^0.17.17 => 0.17.17 
    histoire: ^0.17.17 => 0.17.17

Used Package Manager

yarn

Validations

@did did added the to triage This issue needs to be triaged label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant