unjs / magic-regexp

A compiled-away, type-safe, readable RegExp alternative

Home Page:https://regexp.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: Documentation

Muurilo opened this issue Β· comments

πŸ†’ Your use case

creating project documentation, documentation even at the beginning of the project is important for more people to test and give more ideas and get feedback from the community.

πŸ†• The solution you'd like

Vitepress, is powerful and can be easily implemented.

πŸ” Alternatives you've considered

No response

ℹ️ Additional info

No response

Absolutely! I've added some more docs in the README for now: 45cba26. What do you think is particularly missing at the moment? Examples?

@danielroe Thanks for your work! I would like to know how to use this in a project ? I tried to use it but got errors in my Laravel+Vite+Vue project:

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/hassan/project/node_modules/.pnpm/magic-regexp@0.2.1_vite@3.0.1/node_modules/magic-regexp/dist/transform.mjs not supported.

Does this tool only work in specific environment ?

@HassanZahirnia Currently you can only import it in an ESM context. What does your vite config look like? Is it written in CJS or ESM?

@HassanZahirnia Currently you can only import it in an ESM context. What does your vite config look like? Is it written in CJS or ESM?

I believe it's ESM

Here is a portion of my vite.config.ts:

import { defineConfig } from 'vite'
import laravel, { callArtisan, findPhpPath } from 'vite-plugin-laravel'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import inertiaLayout from './resources/js/inertia/layout'
import DefineOptions from 'unplugin-vue-define-options/vite'

export default defineConfig({
    optimizeDeps: {
        include: [
            // ... omitted for cleaner example
        ]
    },
    plugins: [
        AutoImport({
             // ... omitted for cleaner example
        }),
        inertiaLayout(),
        vue(),
        DefineOptions(),
        // ... omitted for cleaner example

@HassanZahirnia Would you provide a reproduction and open a new issue? πŸ™ I can't reproduce it with a Vite 3 project following the instructions in the README.

@HassanZahirnia Would you provide a reproduction and open a new issue? πŸ™ I can't reproduce it with a Vite 3 project following the instructions in the README.

Here #11