histoire icon indicating copy to clipboard operation
histoire copied to clipboard

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of URL

Open throrin19 opened this issue 9 months ago • 1 comments

Describe the bug

When I try to declare props story and variant on my wrapper, I have this error for all my stories :

Failed to resolve import "tailwindcss/resolveConfig.js" from "node_modules/histoire/dist/node/builtin-plugins/tailwind-tokens.js". Does the file exist?

Error while collecting story /Users/benjamin.besse/Development/vue/manager-v2/stories/components/AqDialog.story.vue:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of URL
    at Object.openSync (node:fs:595:10)
    at readFileSync (node:fs:471:35)
    at file:///Users/benjamin.besse/Development/vue/manager-v2/node_modules/vite/dist/node/constants.js:5:32
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Reproduction

Have a basic Wrapper like this :

<template>
    <div>
        <slot />
    </div>
</template>

<script lang="ts" setup>
</script>

And declare it in histoire.setup.ts :

// ...
import GlobalWrapper from './GlobalWrapper.vue';

export const setupVue3 = defineSetupVue3(({ app, addWrapper }) => {
    // ...
    addWrapper(GlobalWrapper);
});

With that, it works fine.

Now, add just this in the <script setup> :

<script lang="ts" setup>
import { Story, Variant } from 'histoire';

const props = defineProps<{
  story: Story
  variant?: Variant
}>();
</script>

And the error appears for each stories

System Info

System:
    OS: macOS 13.5.2
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 1.31 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
    pnpm: 7.30.0 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 117.0.5938.88
    Edge: 114.0.1823.55
    Safari: 16.6
  npmPackages:
    @histoire/controls: 0.17.0 => 0.17.0 
    @histoire/plugin-vue: 0.17.1 => 0.17.1 
    @vitejs/plugin-vue: 4.3.4 => 4.3.4 
    histoire: 0.17.0 => 0.17.0 
    vite: 4.4.9 => 4.4.9

Used Package Manager

npm

Validations

throrin19 avatar Sep 19 '23 08:09 throrin19