diff --git a/package.json b/package.json index 165a63c9..c1951232 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "type": "commonjs", "exports": { ".": { - "import": "./dist/index.js", + "import": "./dist/esm/index.js", "require": "./dist/index.js", "types": "./dist/index.d.ts" } @@ -41,7 +41,9 @@ "dist" ], "scripts": { - "build": "tsc --project tsconfig.build.json", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --project tsconfig.build.json", + "build:esm": "tsc --project tsconfig.build.esm.json", "format": "prettier . --write", "lint": "npm run lint:eslint && npm run lint:markdownlint && npm run lint:prettier", "lint:eslint": "eslint .", diff --git a/src/validators/index.ts b/src/validators/index.ts index e7989002..13a0d635 100644 --- a/src/validators/index.ts +++ b/src/validators/index.ts @@ -1,5 +1,3 @@ -import Vue from 'vue'; - export type Validator = (value: unknown) => string | undefined; export type VuePropValidator = (value: unknown) => boolean; @@ -23,13 +21,7 @@ export function vuePropValidator( for (const validator of validators) { const errorMessage = validator(value); if (errorMessage) { - if (typeof Vue === 'object' && 'util' in Vue) { - // @ts-expect-error -- Vue.util is only available in Vue 2, but provides more context than console.warn - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - Vue.util.warn(`${errorMessage} (received: '${String(value)}')`); - } else { - console.warn(`${errorMessage} (received: '${String(value)}')`); - } + console.warn(`${errorMessage} (received: '${String(value)}')`); return false; } } diff --git a/tsconfig.build.esm.json b/tsconfig.build.esm.json new file mode 100644 index 00000000..6ae5b73d --- /dev/null +++ b/tsconfig.build.esm.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "module": "esnext", + "moduleResolution": "bundler", + "outDir": "./dist/esm", + "declaration": false + } +} diff --git a/tsconfig.json b/tsconfig.json index b57fc148..43d89015 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "target": "es2019", "module": "node16", "declaration": true, - "outDir": "./dist/", + "outDir": "./dist", "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true,