Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vite-plugin): change default export to named export #1465

Merged
merged 2 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vite-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ npm install --save-dev @lingui/vite-plugin

```ts
import { UserConfig } from 'vite';
import lingui from '@lingui/vite-plugin'
import { lingui } from '@lingui/vite-plugin'

const config: UserConfig = {
plugins: [lingui()]
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from "./src"
export { default, lingui } from "./src"
22 changes: 3 additions & 19 deletions packages/vite-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
"name": "@lingui/vite-plugin",
"version": "3.17.1",
"description": "Vite plugin for Lingui message catalogs",
"main": "./build/cjs/index.js",
"module": "./build/esm/index.js",
"types": "./build/esm/index.d.ts",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"license": "MIT",
"keywords": [
"vite-plugin",
Expand All @@ -18,10 +17,7 @@
"translation"
],
"scripts": {
"clean": "rimraf ./build",
"build:esm": "tsc --module esnext --outDir ./build/esm",
"build:cjs": "tsc --module commonjs --outDir ./build/cjs",
"build": "yarn clean && yarn build:esm && yarn build:cjs"
"build": "rimraf ./build && tsc"
},
"repository": {
"type": "git",
Expand All @@ -30,18 +26,6 @@
"bugs": {
"url": "https://github.com/lingui/js-lingui/issues"
},
"exports": {
".": {
"require": {
"types": "./build/cjs/index.d.ts",
"default": "./build/cjs/index.js"
},
"import": {
"types": "./build/esm/index.d.ts",
"default": "./build/esm/index.js"
}
}
},
"engines": {
"node": ">=14.0.0"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/vite-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type LinguiConfigOpts = {
skipValidation?: boolean
}

export default function lingui(linguiConfig: LinguiConfigOpts = {}): Plugin {
export function lingui(linguiConfig: LinguiConfigOpts = {}): Plugin {
const config = getConfig(linguiConfig)

return {
Expand Down Expand Up @@ -56,3 +56,5 @@ export default function lingui(linguiConfig: LinguiConfigOpts = {}): Plugin {
},
}
}

export default lingui
4 changes: 2 additions & 2 deletions packages/vite-plugin/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import path from "path"
import vitePlugin from "../src"
import { lingui } from "../src"

describe("vite-plugin", () => {
it("should return compiled catalog", async () => {
const p = vitePlugin({
const p = lingui({
configPath: path.resolve(__dirname, ".linguirc"),
})
const result = await (p.transform as any)(
Expand Down
1 change: 0 additions & 1 deletion packages/vite-plugin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"sourceMap": true,
"noEmit": false,
"declaration": true,
"moduleResolution": "Node",
"outDir": "./build",
"esModuleInterop": true,
"resolveJsonModule": true
Expand Down
2 changes: 1 addition & 1 deletion website/docs/ref/vite-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Simply add `@lingui/vite-plugin` inside your `vite.config.ts`:

```ts title="vite.config.ts"
import { UserConfig } from 'vite';
import lingui from '@lingui/vite-plugin'
import { lingui } from '@lingui/vite-plugin'

const config: UserConfig = {
plugins: [lingui()]
Expand Down