Skip to content

Commit e8ee8c5

Browse files
authored
feat: ESM first (#493)
* feat: ESM first * chore: remove CJS * chore: remove pwa plugin d.cts
1 parent c59de75 commit e8ee8c5

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

package.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "vite-plugin-pwa",
3+
"type": "module",
34
"version": "0.14.7",
45
"packageManager": "[email protected]",
56
"description": "Zero-config PWA for Vite",
@@ -25,11 +26,12 @@
2526
"vite",
2627
"vite-plugin"
2728
],
29+
"sideEffects": false,
2830
"exports": {
2931
".": {
3032
"types": "./dist/index.d.ts",
31-
"import": "./dist/index.mjs",
32-
"require": "./dist/index.js"
33+
"require": "./dist/index.cjs",
34+
"import": "./dist/index.js"
3335
},
3436
"./types": {
3537
"types": "./types/index.d.ts"
@@ -61,12 +63,12 @@
6163
"./*": "./*"
6264
},
6365
"main": "dist/index.js",
64-
"module": "dist/index.mjs",
65-
"types": "index.d.ts",
66+
"module": "dist/index.js",
67+
"types": "dist/index.d.ts",
6668
"files": [
6769
"dist",
68-
"*.d.ts",
69-
"types"
70+
"types",
71+
"*.d.ts"
7072
],
7173
"scripts": {
7274
"docs": "npm -C docs run dev",

src/modules.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function generateRegisterSW(options: ResolvedVitePWAOptions, mode:
4242
const sw = options.buildBase + options.filename
4343
const scope = options.scope
4444

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

4747
return content
4848
.replace(/__SW__/g, sw)

types/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"//": "this file is here to make typescript happy when moduleResolution=node16+"
2+
"type": "module"
33
}

0 commit comments

Comments
 (0)