Skip to content

Commit b167883

Browse files
fix: Add missing extensions to ESM imports (#5751)
1 parent 7b753d3 commit b167883

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"cpy-cli": "^4.2.0",
5757
"current-git-branch": "^1.1.0",
5858
"esbuild": "^0.18.13",
59+
"esbuild-plugin-file-path-extensions": "^1.0.0",
5960
"eslint": "^8.34.0",
6061
"eslint-config-prettier": "^8.8.0",
6162
"eslint-import-resolver-typescript": "^3.5.5",

packages/eslint-plugin-query/tsup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { defineConfig } from 'tsup'
44
import { legacyConfig } from '../../scripts/getTsupConfig.js'
55

66
export default defineConfig([
7-
legacyConfig({ entry: ['src/*.ts', 'src/*.tsx'], bundle: true }),
7+
legacyConfig({ entry: ['src/*.ts', 'src/*.tsx'] }),
88
])

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/getTsupConfig.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// @ts-check
22

3+
import { esbuildPluginFilePathExtensions } from 'esbuild-plugin-file-path-extensions'
4+
35
/**
46
* @param {Object} opts - Options for building configurations.
57
* @param {string[]} opts.entry - The entry array.
6-
* @param {boolean} [opts.bundle] - Whether to bundle the output.
78
* @returns {import('tsup').Options}
89
*/
910
export function modernConfig(opts) {
@@ -12,18 +13,16 @@ export function modernConfig(opts) {
1213
format: ['cjs', 'esm'],
1314
target: ['chrome91', 'firefox90', 'edge91', 'safari15', 'ios15', 'opera77'],
1415
outDir: 'build/modern',
15-
bundle: opts.bundle || false,
16-
splitting: opts.bundle || false,
1716
dts: true,
1817
sourcemap: true,
1918
clean: true,
19+
esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })],
2020
}
2121
}
2222

2323
/**
2424
* @param {Object} opts - Options for building configurations.
2525
* @param {string[]} opts.entry - The entry array.
26-
* @param {boolean} [opts.bundle] - Whether to bundle the output.
2726
* @returns {import('tsup').Options}
2827
*/
2928
export function legacyConfig(opts) {
@@ -32,10 +31,9 @@ export function legacyConfig(opts) {
3231
format: ['cjs', 'esm'],
3332
target: ['es2020', 'node16'],
3433
outDir: 'build/legacy',
35-
bundle: opts.bundle || false,
36-
splitting: opts.bundle || false,
3734
dts: true,
3835
sourcemap: true,
3936
clean: true,
37+
esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })],
4038
}
4139
}

0 commit comments

Comments
 (0)