Skip to content

Commit 659ba90

Browse files
committed
fix: improve esm support, fix #1524
1 parent dd01cee commit 659ba90

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

packages/vue-apollo-components/build/rollup.config.es.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import base from './rollup.config.base'
22

33
const config = Object.assign({}, base, {
44
output: {
5-
file: 'dist/vue-apollo-components.esm.js',
5+
file: 'dist/vue-apollo-components.esm.mjs',
66
format: 'es',
77
name: 'vue-apollo-components',
88
},

packages/vue-apollo-components/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"version": "4.0.0-beta.12",
44
"description": "Apollo GraphQL components for Vue.js",
55
"main": "dist/vue-apollo-components.umd.js",
6-
"module": "dist/vue-apollo-components.esm.js",
6+
"module": "dist/vue-apollo-components.esm.mjs",
77
"unpkg": "dist/vue-apollo-components.min.js",
88
"exports": {
99
".": {
10-
"import": "./dist/vue-apollo-components.esm.js",
10+
"import": "./dist/vue-apollo-components.esm.mjs",
1111
"require": "./dist/vue-apollo-components.umd.js"
1212
},
1313
"./*": "./*"

packages/vue-apollo-option/build/rollup.config.es.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import base from './rollup.config.base'
22

33
const config = Object.assign({}, base, {
44
output: {
5-
file: 'dist/vue-apollo-option.esm.js',
5+
file: 'dist/vue-apollo-option.esm.mjs',
66
format: 'es',
77
name: 'vue-apollo',
88
},

packages/vue-apollo-option/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"version": "4.0.0-beta.12",
44
"description": "Use Apollo and GraphQL with Vue.js using the `apollo` option",
55
"main": "dist/vue-apollo-option.umd.js",
6-
"module": "dist/vue-apollo-option.esm.js",
6+
"module": "dist/vue-apollo-option.esm.mjs",
77
"unpkg": "dist/vue-apollo-option.min.js",
88
"types": "types/index.d.ts",
99
"exports": {
1010
".": {
1111
"types": "./types/index.d.ts",
12-
"import": "./dist/vue-apollo-option.esm.js",
12+
"import": "./dist/vue-apollo-option.esm.mjs",
1313
"require": "./dist/vue-apollo-option.umd.js"
1414
},
1515
"./*": "./*"

packages/vue-apollo-ssr/build.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import path from 'node:path'
2+
import fs from 'node:fs'
3+
4+
const file = path.join(process.cwd(), 'dist', 'esm', 'package.json')
5+
6+
fs.writeFileSync(file, JSON.stringify({
7+
"type": "module",
8+
}, null, 2), 'utf-8')

packages/vue-apollo-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
],
3939
"scripts": {
4040
"dev": "pnpm run build --watch",
41-
"build": "rm -rf dist && tsc --outDir dist/esm -d && tsc --outDir dist/cjs --module commonjs --target ES2015",
41+
"build": "rm -rf dist && tsc --outDir dist/esm -d && tsc --outDir dist/cjs --module commonjs --target ES2015 && node ./build.mjs",
4242
"prepublishOnly": "pnpm run build"
4343
},
4444
"dependencies": {

0 commit comments

Comments
 (0)