Skip to content

Commit

Permalink
fix: cjs/esm dual packages (#221)
Browse files Browse the repository at this point in the history
* fix: cjs/esm dual packages

* fix

* fix: esm build error

* fix

* fix
  • Loading branch information
kazupon authored Jun 10, 2024
1 parent 015fb15 commit 05bb19e
Show file tree
Hide file tree
Showing 8 changed files with 425 additions and 396 deletions.
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ __snapshots__
test
etc
dist/*.json
dist/cjs/*.d.ts
dist/esm/*.d.ts
temp/
728 changes: 364 additions & 364 deletions api-extractor.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"@intlify/vue-i18n-extensions": "workspace:*",
"typescript": "^5.0.2",
"vite": "^5.2.11",
"vue-tsc": "^2.0.17"
Expand Down
2 changes: 1 addition & 1 deletion example/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import vue from '@vitejs/plugin-vue'
// import vueJsx from '@vitejs/plugin-vue-jsx'
// import vueI18n from '@intlify/unplugin-vue-i18n/vite'
// import bodyParser from 'body-parser'
import { transformVTDirective } from '../lib/index'
import { transformVTDirective } from '@intlify/vue-i18n-extensions'
// import { transformVTDirective } from '@intlify/vue-i18n-extensions'

/**
Expand Down
73 changes: 42 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
"bugs": {
"url": "https://github.com/intlify/vue-i18n-extensions/issues"
},
"homepage": "https://github.com/intlify/vue-i18n-extensions#readme",
"keywords": [
"extensions",
"i18n",
"optimaization",
"server-side-rendering",
"vue",
"vue-i18n"
],
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.24.6",
"@intlify/shared": "^9.0.0",
Expand Down Expand Up @@ -66,37 +76,21 @@
"optional": true
}
},
"engines": {
"node": ">= 18"
},
"files": [
"lib/*.js",
"dist/cjs/*.js",
"dist/esm/*.js",
"dist/*.d.ts"
],
"homepage": "https://github.com/intlify/vue-i18n-extensions#readme",
"keywords": [
"extensions",
"i18n",
"optimaization",
"server-side-rendering",
"vue",
"vue-i18n"
],
"license": "MIT",
"lint-staged": {
"*.{json,md,yml}": [
"prettier --write"
],
"*.{js,mjs,cjs}": [
"prettier --write",
"eslint --fix"
],
"*.ts?(x)": [
"prettier --parser=typescript --write",
"eslint --fix"
]
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/vue-i18n-extensions.d.ts",
"exports": {
".": {
"types": "./dist/vue-i18n-extensions.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
}
},
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/intlify/vue-i18n-extensions.git"
Expand All @@ -109,7 +103,9 @@
"build:nightly": "pnpm build:transpile && pnpm build:extract",
"build:docs": "api-docs-gen ./temp/vue-i18n-extensions.api.json -c ./docsgen.config.js -o ./docs",
"build:extract": "api-extractor run -l -c ./api-extractor.json --typescript-compiler-folder node_modules/typescript",
"build:transpile": "tsc -p tsconfig.build.json",
"build:transpile": "run-s build:transpile:*",
"build:transpile:cjs": "tsc -p tsconfig.cjs.json",
"build:transpile:esm": "tsc -p tsconfig.esm.json",
"check-install": "tsx scripts/playwright.ts",
"clean": "git clean -fdx",
"coverage": "opener coverage/lcov-report/index.html",
Expand All @@ -125,8 +121,23 @@
"test:e2e": "vitest -c ./vitest.e2e.config.ts run",
"test:unit": "vitest run",
"test:watch": "vitest --no-cache --watch",
"watch": "tsc -p tsconfig.build.json --watch"
"watch": "tsc -p tsconfig.cjs.json --watch"
},
"types": "dist/vue-i18n-extensions.d.ts",
"packageManager": "pnpm@9.2.0"
"packageManager": "pnpm@9.2.0",
"engines": {
"node": ">= 18"
},
"lint-staged": {
"*.{json,md,yml}": [
"prettier --write"
],
"*.{js,mjs,cjs}": [
"prettier --write",
"eslint --fix"
],
"*.ts?(x)": [
"prettier --parser=typescript --write",
"eslint --fix"
]
}
}
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tsconfig.build.json → tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/cjs"
},
"include": ["./src/**/*"]
}
9 changes: 9 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/esm",
"module": "esnext",
"moduleResolution": "Bundler"
},
"include": ["./src/**/*"]
}

0 comments on commit 05bb19e

Please sign in to comment.