Skip to content

Commit cdad45c

Browse files
authored
Fix build entry resolving error (#12)
* fix: build entry resolving error * fix: export `CommandInteraction` as type * fix: remove no more use dependency * chore: add changeset
1 parent 08333f2 commit cdad45c

File tree

5 files changed

+15
-322
lines changed

5 files changed

+15
-322
lines changed

.changeset/evil-dolls-tell.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'harmonix': patch
3+
'@harmonix-js/cli': patch
4+
---
5+
6+
Fix build entry resolving error

packages/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"pkg-types": "^2.3.0",
5353
"pretty-bytes": "^6.1.1",
5454
"rollup": "^4.52.5",
55-
"rollup-plugin-esbuild": "^6.2.1",
5655
"scule": "^1.3.0",
5756
"std-env": "^3.10.0",
5857
"tinyexec": "^1.0.1",

packages/cli/src/commands/build/config.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { builtinModules } from 'node:module'
12
import { sanitizeFilePath } from 'mlly'
2-
import { dirname, normalize, relative, resolve } from 'pathe'
3+
import { dirname, normalize, relative } from 'pathe'
34
import { nodeResolve } from '@rollup/plugin-node-resolve'
4-
import esbuild from 'rollup-plugin-esbuild'
55
import commonjs from '@rollup/plugin-commonjs'
66
import json from '@rollup/plugin-json'
77

@@ -17,15 +17,15 @@ export const getRollupConfig = (
1717
rootDir: string
1818
): RollupOptions => {
1919
return {
20-
input: resolveEntry('../runtime/harmonix.mjs', import.meta.url),
21-
external: ['discord.js'],
20+
input: resolveEntry('./runtime/harmonix.mjs', import.meta.url),
21+
external: [
22+
'discord.js',
23+
...builtinModules,
24+
...builtinModules.map((m) => `node:${m}`)
25+
],
2226
plugins: [
2327
config(harmonix.options),
2428
modules(harmonix),
25-
esbuild({
26-
target: 'es2022',
27-
platform: 'node'
28-
}),
2929
nodeResolve({
3030
preferBuiltins: true,
3131
rootDir,
@@ -70,10 +70,8 @@ export const getRollupConfig = (
7070
},
7171
format: 'esm',
7272
exports: 'auto',
73-
generatedCode: { constBindings: true },
7473
sanitizeFileName: sanitizeFilePath,
7574
sourcemap: harmonix.options.sourceMap,
76-
sourcemapExcludeSources: true,
7775
sourcemapIgnoreList: (p) => p.includes('node_modules')
7876
}
7977
}

packages/harmonix/src/pipeline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CommandInteraction } from 'discord.js'
1+
import type { CommandInteraction } from 'discord.js'
22

33
import type { Middleware } from './types/runtime/pipeline'
44

0 commit comments

Comments
 (0)