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

Vite import problem and workaround #118

Open
brianmercer opened this issue May 3, 2023 · 0 comments
Open

Vite import problem and workaround #118

brianmercer opened this issue May 3, 2023 · 0 comments

Comments

@brianmercer
Copy link

brianmercer commented May 3, 2023

Using Vitepress and Vite with SSR, I used this import:

  import { 
    Dataset,
    DatasetItem,
    DatasetInfo,
    DatasetPager,
    DatasetSearch,
    DatasetShow
  } from 'vue-dataset'

and received this error:

SyntaxError: Named export 'Dataset' not found. The requested module 'vue-dataset' is a CommonJS module, which may not support all module.exports as named exports.

I don't know exactly what Vite doesn't like about the package but I found a workaround using:

// vite.config.js

export default {
  ssr: {
    // Add npm packages containing invalid code here
    noExternal: ['vue-dataset']
  }
}

from this page: https://vite-plugin-ssr.com/broken-npm-package#solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants