question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

import element-plus css.

See original GitHub issue

SSG building produce an issue, when use button of element-plus. CSS importing has some problem.

[vite-ssg] Build for server...
vite v2.7.6 building SSR bundle for production...
✓ 52 modules transformed.
.vite-ssg-temp/manifest.webmanifest        0.38 KiB
.vite-ssg-temp/main.mjs                    61.38 KiB
.vite-ssg-temp/assets/style.52c8292a.css   21.69 KiB

[vite-ssg] An internal error occurred.
[vite-ssg] Please report an issue, if none already exists: https://github.com/antfu/vite-ssg/issues
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/rzp/Code/github/vitesee/node_modules/element-plus/es/components/button/style/css' imported from /Users/rzp/Code/github/vitesee/.vite-ssg-temp/main.mjs
    at new NodeError (node:internal/errors:371:5)
    at finalizeResolution (node:internal/modules/esm/resolve:391:11)
    at moduleResolve (node:internal/modules/esm/resolve:893:10)
    at Loader.defaultResolve [as _resolve] (node:internal/modules/esm/resolve:1004:11)
    at Loader.resolve (node:internal/modules/esm/loader:89:40)
    at Loader.getModuleJob (node:internal/modules/esm/loader:242:28)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:11

github_iconTop GitHub Comments

7reactions
shazhou2015commented, Aug 12, 2022

I add the ssr options in vite.config.js, it works for me.

ssr: {
    noExternal: ['element-plus']
}
4reactions
xingzichencommented, Jun 10, 2022

try this in vite.config Components({ ... resolvers: [ ElementPlusResolver({ importStyle: 'css', ssr: true }), ... ] })

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quick Start | Element Plus
Manually import​​ Element Plus provides out of box Tree Shaking functionalities based on ES Module. But you need install unplugin-element-plus for style import. ......
Read more >
How to add element-ui (now called element-plus) to Vue3 ...
If you are using vue 3 you need to import createApp as well as css from 'element-plus/...' folder. Then you instance your app...
Read more >
unplugin-element-plus - npm
Features · On-demand import style for Element Plus. · Replace default locale. · ⚡️ Supports Vite, Webpack, Vue CLI, Rollup, esbuild and ...
Read more >
Element Plus Playground
import { version as EpVersion } from 'element-plus'. 4. import { ElementPlus } from '@element-plus/icons-vue'. 5. ​. 6. const msg = ref('Hello World!')....
Read more >
How to Install Element Plus on Laravel Jetstream - Medium
Third, on the app.js file in your project, import ElementPlus including the css file, and don't forget to add the .use(ElementPlus) at the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found