Skip to content

Commit 32d131e

Browse files
committed
fix: es module build with unbuild
1 parent 8700139 commit 32d131e

File tree

10 files changed

+110
-51
lines changed

10 files changed

+110
-51
lines changed

build.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineBuildConfig } from 'unbuild'
22

33
export default defineBuildConfig({
44
declaration: true,
5-
emitCJS: false,
5+
emitCJS: true,
66
outDir: 'lib',
77
entries: ['src/index', 'src/cli']
88
})

locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@
77
"Success compilation: {source} -> {output}": "Success compilation: {source} -> {output}",
88
"{source}: Ignore compilation due to not supported '{ext}'": "{source}: Ignore compilation due to not supported '{ext}'",
99
"Warning compilation: {source} -> {output}, {msg}": "Warning compilation: {source} -> {output}, {msg}",
10-
"Error compilation: {source} -> {output}, {msg}": "Error compilation: {source} -> {output}, {msg}"
10+
"Error compilation: {source} -> {output}, {msg}": "Error compilation: {source} -> {output}, {msg}",
11+
"annotate the attributes": "annotate the attributes",
12+
"the target path": "the target path",
13+
"the annotation mode": "the annotation mode",
14+
"the attributes to annotate": "the attributes to annotate"
1115
}

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
},
2929
"dependencies": {
3030
"@intlify/bundle-utils": "^0.3.0",
31-
"@intlify/core-base": "^9.1.9",
31+
"@intlify/core": "^9.1.9",
3232
"@intlify/shared": "^9.1.9",
3333
"chalk": "^4.1.0",
3434
"debug": "^4.3.2",
35-
"glob": "^7.2.0",
35+
"fast-glob": "^3.2.7",
3636
"pathe": "^0.2.0",
3737
"yargs": "^17.2.0"
3838
},
@@ -75,18 +75,18 @@
7575
},
7676
"exports": {
7777
".": {
78-
"import": "./index.mjs",
79-
"require": "./index.js"
78+
"import": "./lib/index.mjs",
79+
"require": "./lib/index.cjs"
8080
},
8181
"./dist/*": "./dist/*",
82+
"./lib/*": "./lib/*",
8283
"./package.json": "./package.json"
8384
},
8485
"files": [
85-
"bin/*.js",
86+
"bin/*.mjs",
8687
"locales/*.json",
8788
"dist/*.d.ts",
88-
"lib/index.cjs",
89-
"lib/index.mjs"
89+
"lib/"
9090
],
9191
"gitHooks": {
9292
"pre-commit": "lint-staged"

pnpm-lock.yaml

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

src/cli.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
import * as yargs from 'yargs'
1+
import yargs from 'yargs'
2+
import { hideBin } from 'yargs/helpers'
23
import { initI18n, t } from './i18n'
4+
import { compile, annotate } from './commands'
5+
/**
6+
* CLI entrypoint
7+
*/
38
;(async () => {
49
await initI18n()
5-
yargs
10+
yargs(hideBin(process.argv))
611
.scriptName('intlify')
712
.usage(t('Usage: $0 <command> [options]'))
8-
.commandDir('./commands')
13+
.command(compile)
14+
.command(annotate)
915
.demandCommand()
1016
.help()
1117
.version().argv

0 commit comments

Comments
 (0)