robcresswell / vue-material-design-icons

Material Design Icons as Vue Single File Components
https://npmjs.com/vue-material-design-icons
MIT License
162 stars 35 forks source link

Error when build in docker or gh action `[vite]: Rollup failed to resolve import "vue-material-design-icons/ToolBox.vue" from "/app/src/components/LabelIcon.vue".` #292

Closed zyxkad closed 1 year ago

zyxkad commented 1 year ago

When I build my project (do vite build), it failed by cannot import the icon. But it works well on my host, idk why

Error Log:

 > [build 6/6] RUN --mount=type=cache,target=/root/.npm  npm run build:                                                                                     
#13 0.326                                                                                                                                                   
#13 0.326 > vue-project@0.0.0 build                                                                                                                         
#13 0.326 > vite build                                                                                                                                      
#13 0.326 
#13 0.724 build production
#13 0.759 vite v4.1.4 building for production...
#13 0.810 transforming...
#13 1.700 āœ“ 158 modules transformed.
#13 1.701 [vite]: Rollup failed to resolve import "vue-material-design-icons/ToolBox.vue" from "/app/src/components/LabelIcon.vue".
#13 1.701 This is most likely unintended because it can break your application at runtime.
#13 1.701 If you do want to externalize this module explicitly add it to
#13 1.701 `build.rollupOptions.external`
#13 1.702 error during build:
#13 1.702 Error: [vite]: Rollup failed to resolve import "vue-material-design-icons/ToolBox.vue" from "/app/src/components/LabelIcon.vue".
#13 1.702 This is most likely unintended because it can break your application at runtime.
#13 1.702 If you do want to externalize this module explicitly add it to
#13 1.702 `build.rollupOptions.external`
#13 1.702     at onRollupWarning (file:///app/node_modules/vite/dist/node/chunks/dep-ca21228b.js:44792:19)
#13 1.702     at onwarn (file:///app/node_modules/vite/dist/node/chunks/dep-ca21228b.js:44562:13)
#13 1.702     at Object.onwarn (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:24950:13)
#13 1.702     at ModuleLoader.handleInvalidResolvedId (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:23632:26)
#13 1.702     at file:///app/node_modules/rollup/dist/es/shared/node-entry.js:23592:26

package.json

{
  "name": "vue-project",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "build_dev": "vite build --mode development --debug true",
    "build_watch": "vite build --mode development --debug true --watch true --clearScreen false",
    "preview": "vite build && vite preview",
    "server": "node ./server"
  },
  "dependencies": {
    "@jridgewell/sourcemap-codec": "^1.4.15",
    "@mdi/svg": "^7.1.96",
    "axios": "^1.3.4",
    "compression": "^1.7.4",
    "express": "^4.18.2",
    "github-markdown-css": "^5.2.0",
    "vite-plugin-ssr": "^0.4.126",
    "vue": "^3.2.47",
    "vue-cookies": "^1.8.3",
    "vue-gtag": "^2.0.1",
    "vue-i18n": "^9.2.2",
    "vue-material-design-icons": "^5.2.0",
    "vue-request": "^2.0.0-rc.4",
    "vue-router": "^4.1.6"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^4.0.0",
    "@vitejs/plugin-vue-jsx": "^3.0.0",
    "vite": "^4.1.4"
  }
}
robcresswell commented 1 year ago

Hey @zyxkad thanks for the report. Unfortunately, I don't have the bandwidth to help everyone debug their build processes šŸ˜„ Good luck!

zyxkad commented 1 year ago

@robcresswell I don't know if this pack only suitable for vue2? Because the example is for vue2, but I'm using vue3

robcresswell commented 1 year ago

@zyxkad No, it should be compatible with both

zyxkad commented 1 year ago

Continue record: I tried use exactly same docker image, but one use docker copy to get the project files, others used mount. The docker copy one throw the error, but the mounted one not. I guess this issue is probably because filesystem? uh?

zyxkad commented 1 year ago

Well, sorry for that, I finally found the issue, in MacOS, import seems is case insensitive, it should be import Toolbox.vue but not ToolBox.vue

robcresswell commented 1 year ago

Thats cool, thanks for updating the issue @zyxkad and I'm glad you got it sorted out!