Skip to content

Commit

Permalink
fix: cjs and esm build bundled to lib dir
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianOsipiuk committed Jul 21, 2022
1 parent 6e73c78 commit c35eb87
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 39 deletions.
8 changes: 4 additions & 4 deletions packages/query-async-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"module": "build/esm/index.mjs",
"main": "build/cjs/index.js",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/types/packages/query-async-storage-persister/src/index.d.ts",
"exports": {
".": {
"import": "./build/esm/index.mjs",
"default": "./build/cjs/index.js"
"import": "./build/lib/index.mjs",
"default": "./build/lib/index.js"
},
"./package.json": "./package.json"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/query-broadcast-client-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"module": "build/esm/index.mjs",
"main": "build/cjs/packages/query-broadcast-client-experimental/src/index.js",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/types/query-broadcast-client-experimental/src/index.d.ts",
"exports": {
".": {
"import": "./build/esm/index.mjs",
"default": "./build/cjs/packages/query-broadcast-client-experimental/src/index.js"
"import": "./build/lib/index.mjs",
"default": "./build/lib/index.js"
},
"./package.json": "./package.json"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"module": "build/esm/index.mjs",
"main": "build/cjs/index.js",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/types/packages/query-core/src/index.d.ts",
"exports": {
".": {
"import": "./build/esm/index.mjs",
"default": "./build/cjs/index.js"
"import": "./build/lib/index.mjs",
"default": "./build/lib/index.js"
},
"./package.json": "./package.json"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/query-sync-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"module": "build/esm/index.mjs",
"main": "build/cjs/index.js",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/types/packages/query-sync-storage-persister/src/index.d.ts",
"exports": {
".": {
"import": "./build/esm/index.mjs",
"default": "./build/cjs/index.js"
"import": "./build/lib/index.mjs",
"default": "./build/lib/index.js"
},
"./package.json": "./package.json"
},
Expand Down
16 changes: 8 additions & 8 deletions packages/react-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"module": "build/esm/index.mjs",
"main": "build/cjs/packages/react-query-devtools/src/index.js",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/types/react-query-devtools/src/index.d.ts",
"files": [
Expand All @@ -21,17 +21,17 @@
"exports": {
".": {
"development": {
"require": "./build/cjs/packages/react-query-devtools/src/index.js",
"default": "./build/esm/index.mjs"
"require": "./build/lib/index.js",
"default": "./build/lib/index.mjs"
},
"default": {
"require": "./build/cjs/packages/react-query-devtools/src/noop.js",
"default": "./build/esm/noop.mjs"
"require": "./build/lib/noop.js",
"default": "./build/lib/noop.mjs"
}
},
"./devtools": {
"import": "./build/esm/index.mjs",
"default": "./build/cjs/packages/react-query-devtools/src/index.js"
"import": "./build/lib/index.mjs",
"default": "./build/lib/index.js"
},
"./package.json": "./package.json"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/react-query-persist-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"module": "build/esm/index.mjs",
"main": "build/cjs/react-query-persist-client/src/index.js",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/types/packages/react-query-persist-client/src/index.d.ts",
"exports": {
".": {
"import": "./build/esm/index.mjs",
"default": "./build/cjs/react-query-persist-client/src/index.js"
"import": "./build/lib/index.mjs",
"default": "./build/lib/index.js"
},
"./package.json": "./package.json"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"module": "build/esm/index.mjs",
"main": "build/cjs/react-query/src/index.js",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/types/packages/react-query/src/index.d.ts",
"exports": {
".": {
"import": "./build/esm/index.mjs",
"default": "./build/cjs/react-query/src/index.js"
"import": "./build/lib/index.mjs",
"default": "./build/lib/index.js"
},
"./package.json": "./package.json"
},
Expand Down
21 changes: 14 additions & 7 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,30 @@ export default function rollup(options: RollupOptions): RollupOptions[] {
jsName: 'QueryAsyncStoragePersister',
outputFile: 'query-async-storage-persister',
entryFile: 'src/index.ts',
globals: {},
globals: {
'@tanstack/react-query-persist-client': 'ReactQueryPersistClient',
},
}),
...buildConfigs({
name: 'query-broadcast-client-experimental',
packageDir: 'packages/query-broadcast-client-experimental',
jsName: 'QueryBroadcastClient',
outputFile: 'query-broadcast-client-experimental',
entryFile: 'src/index.ts',
globals: {},
globals: {
'@tanstack/query-core': 'QueryCore',
'broadcast-channel': 'BroadcastChannel',
},
}),
...buildConfigs({
name: 'query-sync-storage-persister',
packageDir: 'packages/query-sync-storage-persister',
jsName: 'QuerySyncStoragePersister',
outputFile: 'query-sync-storage-persister',
entryFile: 'src/index.ts',
globals: {},
globals: {
'@tanstack/react-query-persist-client': 'ReactQueryPersistClient',
},
}),
...buildConfigs({
name: 'react-query',
Expand All @@ -74,6 +81,7 @@ export default function rollup(options: RollupOptions): RollupOptions[] {
entryFile: 'src/index.ts',
globals: {
react: 'React',
'@tanstack/query-core': 'QueryCore',
},
}),
...buildConfigs({
Expand Down Expand Up @@ -146,9 +154,9 @@ function esm({ input, packageDir, external, banner }: Options): RollupOptions {
input,
output: {
format: 'esm',
entryFileNames: "[name].mjs",
entryFileNames: '[name].mjs',
sourcemap: true,
dir: `${packageDir}/build/esm`,
dir: `${packageDir}/build/lib`,
banner,
},
plugins: [
Expand All @@ -168,8 +176,7 @@ function cjs({ input, external, packageDir, banner }: Options): RollupOptions {
output: {
format: 'cjs',
sourcemap: true,
dir: `${packageDir}/build/cjs`,
preserveModules: true,
dir: `${packageDir}/build/lib`,
exports: 'named',
banner,
},
Expand Down

0 comments on commit c35eb87

Please sign in to comment.