Skip to content

Commit

Permalink
Merge pull request #56 from defstudio/mjs-cjs-versions
Browse files Browse the repository at this point in the history
mjs and cjs versions
  • Loading branch information
fabio-ivona authored Jul 7, 2023
2 parents c40a3f4 + 451b95a commit 2576b73
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,23 @@
"url": "https://github.com/def-studio/vite-livewire-plugin"
},
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
},
"files": [
"/dist"
],
"scripts": {
"deploy": "npm run build && npm publish",
"build": "npm run build-plugin",
"build-plugin": "rm -rf dist && tsc",
"build-plugin": "rm -rf dist && npm run build-plugin-types && npm run build-plugin-esm && npm run build-plugin-cjs",
"build-plugin-types": "tsc --emitDeclarationOnly",
"build-plugin-cjs": "esbuild src/index.ts --platform=node --format=cjs --outfile=dist/index.cjs",
"build-plugin-esm": "esbuild src/index.ts --platform=node --format=esm --outfile=dist/index.mjs",
"lint": "eslint --ext .ts ./src",
"test": "vitest run"
},
Expand All @@ -35,6 +43,7 @@
"@types/picomatch": "^2.3.0",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"esbuild": "0.16.10",
"eslint": "^8.14.0",
"typescript": "^5.0.3",
"vite": "^4.0.1",
Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {HmrContext, ModuleNode, Plugin} from "vite";
// noinspection JSUnusedLocalSymbols

import {HmrContext, Plugin} from "vite";
import {Update} from "vite/types/hmrPayload";

import minimatch from 'minimatch';
Expand Down Expand Up @@ -60,6 +62,7 @@ function triggerUpdates(ctx: HmrContext, refreshList: string[]): void {
}
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
function refresh(ctx: HmrContext, config: ResolvedPluginConfig): void {
ctx.server.ws.send({
type: 'custom',
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"outDir": "./dist",
"target": "ES2019",
"module": "CommonJS",
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node",
"resolveJsonModule": true,
"strict": true,
Expand Down

0 comments on commit 2576b73

Please sign in to comment.