Skip to content

Commit

Permalink
fix: improve esm support, fix #1524
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Jan 15, 2024
1 parent dd01cee commit 659ba90
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/vue-apollo-components/build/rollup.config.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import base from './rollup.config.base'

const config = Object.assign({}, base, {
output: {
file: 'dist/vue-apollo-components.esm.js',
file: 'dist/vue-apollo-components.esm.mjs',
format: 'es',
name: 'vue-apollo-components',
},
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-apollo-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"version": "4.0.0-beta.12",
"description": "Apollo GraphQL components for Vue.js",
"main": "dist/vue-apollo-components.umd.js",
"module": "dist/vue-apollo-components.esm.js",
"module": "dist/vue-apollo-components.esm.mjs",
"unpkg": "dist/vue-apollo-components.min.js",
"exports": {
".": {
"import": "./dist/vue-apollo-components.esm.js",
"import": "./dist/vue-apollo-components.esm.mjs",
"require": "./dist/vue-apollo-components.umd.js"
},
"./*": "./*"
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-apollo-option/build/rollup.config.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import base from './rollup.config.base'

const config = Object.assign({}, base, {
output: {
file: 'dist/vue-apollo-option.esm.js',
file: 'dist/vue-apollo-option.esm.mjs',
format: 'es',
name: 'vue-apollo',
},
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-apollo-option/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "4.0.0-beta.12",
"description": "Use Apollo and GraphQL with Vue.js using the `apollo` option",
"main": "dist/vue-apollo-option.umd.js",
"module": "dist/vue-apollo-option.esm.js",
"module": "dist/vue-apollo-option.esm.mjs",
"unpkg": "dist/vue-apollo-option.min.js",
"types": "types/index.d.ts",
"exports": {
".": {
"types": "./types/index.d.ts",
"import": "./dist/vue-apollo-option.esm.js",
"import": "./dist/vue-apollo-option.esm.mjs",
"require": "./dist/vue-apollo-option.umd.js"
},
"./*": "./*"
Expand Down
8 changes: 8 additions & 0 deletions packages/vue-apollo-ssr/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import path from 'node:path'
import fs from 'node:fs'

const file = path.join(process.cwd(), 'dist', 'esm', 'package.json')

fs.writeFileSync(file, JSON.stringify({
"type": "module",
}, null, 2), 'utf-8')
2 changes: 1 addition & 1 deletion packages/vue-apollo-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
],
"scripts": {
"dev": "pnpm run build --watch",
"build": "rm -rf dist && tsc --outDir dist/esm -d && tsc --outDir dist/cjs --module commonjs --target ES2015",
"build": "rm -rf dist && tsc --outDir dist/esm -d && tsc --outDir dist/cjs --module commonjs --target ES2015 && node ./build.mjs",
"prepublishOnly": "pnpm run build"
},
"dependencies": {
Expand Down

0 comments on commit 659ba90

Please sign in to comment.