Skip to content
This repository was archived by the owner on Apr 11, 2023. It is now read-only.

Provide example #16

Description

@stefnotch

I tried out this library, but couldn't quite get it to work.

My repository uses "type": "module" https://github.com/stefnotch/blog/blob/3d8572b060abdcb17ae90f0193766e2d51603214/package.json#L2 and has a minimal vite.config.ts file in the docs folder https://github.com/stefnotch/blog/blob/main/docs/vite.config.ts

When I start mine, I get the following confusing error

> vitepress dev docs

failed to load config from C:\Coding\GitHub\Other\Blog\docs\vite.config.ts
failed to start server. error:
file:///C:/Coding/GitHub/Other/Blog/docs/vite.config.ts.timestamp-1677749039970.mjs:2
import { SimpleSearch } from "file:///C:/Coding/GitHub/Other/Blog/node_modules/vitepress-plugin-simple-search/dist/simple-search.es.js";
         ^^^^^^^^^^^^
SyntaxError: Named export 'SimpleSearch' not found. The requested module 'file:///C:/Coding/GitHub/Other/Blog/node_modules/vitepress-plugin-simple-search/dist/simple-search.es.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'file:///C:/Coding/GitHub/Other/Blog/node_modules/vitepress-plugin-simple-search/dist/simple-search.es.js';
const { SimpleSearch } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)    
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5) 

OS: Windows 10
node --version: v18.14.0
npm --version: 9.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions