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

Failed to resolve module specifier "vue" #214

Closed
Qualterink opened this issue Jul 29, 2022 · 4 comments
Closed

Failed to resolve module specifier "vue" #214

Qualterink opened this issue Jul 29, 2022 · 4 comments
Labels
to triage This issue needs to be triaged

Comments

@Qualterink
Copy link

Describe the bug

I can't deploy production ready version of histoire. When I run npm run story:preview, I see this error in browser:

Uncaught TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../".

Additionally, while building, I see errors like this:

vite v2.9.14 building for development...
transforming (379) node_modules/histoire/dist/bundled/components/base/BaseCheckbox.js'setupVue3' is not exported by '../../../../$histoire-generated-global-setup-resolved'
'setupVue3' is not exported by '../../../../$histoire-generated-global-setup-resolved'
'setupVue3' is not exported by 'src/histoire.setup.ts'
'setupVue3' is not exported by 'src/histoire.setup.ts'
'setupVue3' is not exported by '../../../../$histoire-generated-global-setup-resolved'
'setupVue3' is not exported by '../../../../$histoire-generated-global-setup-resolved'
'setupVue3' is not exported by 'src/histoire.setup.ts'
'setupVue3' is not exported by 'src/histoire.setup.ts'
Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
✓ 392 modules transformed.

Everything is ok when I type npm run story:dev.

Reproduction

histoire setup.ts

import "./lib-components/assets/css/colors.css";
import "./lib-components/assets/css/shadows.css";
import "./lib-components/assets/css/sizes.css";
import "./lib-components/assets/css/spaces.css";
import "./lib-components/assets/css/zIndexes.css";

import { defineSetupVue3 } from "histoire/client";
import Maska from "maska";

import {
  FontAwesomeIcon,
  FontAwesomeLayers
} from "@fortawesome/vue-fontawesome";
import { library } from "@fortawesome/fontawesome-svg-core";
import { fas } from "@fortawesome/free-solid-svg-icons";
import { far } from "@fortawesome/free-regular-svg-icons";
import { fas as fasPro } from "@fortawesome/pro-solid-svg-icons";
import { far as farPro } from "@fortawesome/pro-regular-svg-icons";
import { Dropdown, Menu, Tooltip, VClosePopper, VTooltip } from "floating-vue";
import vClickOutside from "click-outside-vue3";
import { directiveFn } from "@/lib-components/plugins/focusable";
import { AvailableLanguagesEnum } from "./entry";
import mitt from "mitt";
import makeI18n from "@/i18n";
export const i18n = makeI18n(AvailableLanguagesEnum.pl);
import { config } from "@fortawesome/fontawesome-svg-core";
config.autoAddCss = true;

library.add(fas);
library.add(fasPro);
library.add(far);
library.add(farPro);
export default defineSetupVue3(({ app }) => {
  app.use(i18n);
  app.use(Maska);
  app.component("VDropdown", Dropdown);
  app.component("VTooltip", Tooltip);
  app.component("VMenu", Menu);
  app.component("vClickOutside", vClickOutside);

  app.component("fa", FontAwesomeIcon);
  app.component("fal", FontAwesomeLayers);

  app.directive("focusable", directiveFn);
  app.directive("tooltip", VTooltip);
  app.directive("close-popover", VClosePopper);
  app.directive("click-outside", vClickOutside);

  const emitter = mitt();
  app.config.globalProperties.eventBus = emitter;
});

histoire.config.ts

import { defineConfig } from "histoire";

export default defineConfig({
  setupFile: "/src/histoire.setup.ts",
  tree: {
    groups: [
      {
        title: "Variables",
        id: "Variables"
      },
      {
        title: "Components",
        include: (file) => !file.title.includes("Serialize")
      },
      {
        title: "UI",
        id: "UI"
      }
    ]
  }
});

System Info

"vue": "^3.2.37",

node v16.14.2

  System:
    OS: Linux 5.15 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (16) x64 AMD Ryzen 7 5700U with Radeon Graphics
    Memory: 19.10 GB / 30.70 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  Browsers:
    Chrome: 102.0.5005.61
    Firefox: 103.0
  npmPackages:
    @vitejs/plugin-vue: ^2.3.3 => 2.3.3 
    histoire: ^0.8.4 => 0.8.4 
    vite: ^2.9.9 => 2.9.14 


### Used Package Manager

npm

### Validations

- [X] Follow our [Code of Conduct](https:/histoire-dev/histoire/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https:/histoire-dev/histoire/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://histoire.dev/guide/).
- [X] Check that there isn't [already an issue](https:/histoire-dev/histoire/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https:/histoire-dev/histoire/discussions).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
@Qualterink Qualterink added the to triage This issue needs to be triaged label Jul 29, 2022
@Akryum
Copy link
Member

Akryum commented Jul 29, 2022

Please provide a runnable reproduction thank you!

Qualterink added a commit to Qualterink/error-vite-histoire-build that referenced this issue Aug 2, 2022
@Qualterink
Copy link
Author

@Akryum

Reprodcution project:

https:/Qualterink/error-vite-histoire-build

  1. Clone it.
  2. Npm i
  3. Try npm run story:build
  4. Try npm run story:preview -> in browser check console

@Qualterink Qualterink reopened this Aug 2, 2022
@Akryum
Copy link
Member

Akryum commented Aug 2, 2022

This looks to be caused by rollup-plugin-peer-deps-external which externalize vue

@Akryum Akryum closed this as completed in 45f7ba5 Aug 2, 2022
@Qualterink
Copy link
Author

Thank you. Your release to 0.9.1, solves the build problem.

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

2 participants