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

breaking(vite-plugin-vue-i18n): plugin export named default only #158

Merged
merged 1 commit into from
Aug 5, 2022
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-vue-i18n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { defineConfig } from 'vite'
import { resolve, dirname } from 'node:path'
import { fileURLToPath } from 'url'
import vue from '@vitejs/plugin-vue'
import { vueI18n } from '@intlify/vite-plugin-vue-i18n'
import vueI18n from '@intlify/vite-plugin-vue-i18n'

export default defineConfig({
plugins: [
Expand Down
16 changes: 16 additions & 0 deletions packages/vite-plugin-vue-i18n/build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
declaration: true,
outDir: 'lib',
entries: [
{
name: 'index',
input: 'src/index'
}
],
rollup: {
emitCJS: true
},
externals: ['vite']
})
13 changes: 8 additions & 5 deletions packages/vite-plugin-vue-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"fast-glob": "^3.2.5",
"source-map": "0.6.1"
},
"devDependencies": {
"unbuild": "^0.7.6"
},
"engines": {
"node": ">= 14.6"
},
Expand All @@ -51,13 +54,13 @@
"vue-i18n"
],
"license": "MIT",
"main": "lib/index.js",
"module": "./index.mjs",
"main": "lib/index.cjs",
"module": "./lib/index.mjs",
"types": "lib/index.d.ts",
"exports": {
".": {
"import": "./index.mjs",
"require": "./lib/index.js"
"import": "./lib/index.mjs",
"require": "./lib/index.cjs"
},
"./lib/*": "./lib/*",
"./index.mjs": "./index.mjs",
Expand All @@ -69,7 +72,7 @@
"directory": "packages/vite-plugin-vue-i18n"
},
"scripts": {
"build": "tsc -p .",
"build": "unbuild",
"build:example": "vite build --config ./examples/vite.config.ts --outDir ./examples/dist",
"clean": "npm-run-all \"clean:*\"",
"clean:lib": "rm -rf ./lib",
Expand Down
2 changes: 0 additions & 2 deletions packages/vite-plugin-vue-i18n/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,4 @@ async function generateBundleResources(
}`
}

// overwrite for cjs require('...')() usage
export default pluginI18n
export const vueI18n = pluginI18n
Loading