Skip to content

Commit

Permalink
feat: ESM first (#493)
Browse files Browse the repository at this point in the history
* feat: ESM first

* chore: remove CJS

* chore: remove pwa plugin d.cts
  • Loading branch information
userquin committed May 19, 2023
1 parent c59de75 commit e8ee8c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "vite-plugin-pwa",
"type": "module",
"version": "0.14.7",
"packageManager": "pnpm@7.18.1",
"description": "Zero-config PWA for Vite",
Expand All @@ -25,11 +26,12 @@
"vite",
"vite-plugin"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"require": "./dist/index.cjs",
"import": "./dist/index.js"
},
"./types": {
"types": "./types/index.d.ts"
Expand Down Expand Up @@ -61,12 +63,12 @@
"./*": "./*"
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "index.d.ts",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist",
"*.d.ts",
"types"
"types",
"*.d.ts"
],
"scripts": {
"docs": "npm -C docs run dev",
Expand Down
2 changes: 1 addition & 1 deletion src/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function generateRegisterSW(options: ResolvedVitePWAOptions, mode:
const sw = options.buildBase + options.filename
const scope = options.scope

const content = await fs.readFile(resolve(_dirname, `client/${mode}/${source}.mjs`), 'utf-8')
const content = await fs.readFile(resolve(_dirname, `client/${mode}/${source}.js`), 'utf-8')

return content
.replace(/__SW__/g, sw)
Expand Down
2 changes: 1 addition & 1 deletion types/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"//": "this file is here to make typescript happy when moduleResolution=node16+"
"type": "module"
}

0 comments on commit e8ee8c5

Please sign in to comment.