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

ship ESM only #2112

Merged
merged 6 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 1 addition & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ By default, each package will be built in multiple distribution formats as speci
- This means you **must** import everything from this file and this file only to ensure you are getting the same instance of code.
- Hard-coded prod/dev branches, and the prod build is pre-minified (you will have to use different paths/aliases for dev/prod)

- **`cjs`**

- For use in Node.js server-side rendering via `require()`.
- The dev/prod files are pre-built, but are dynamically required based on `process.env.NODE_ENV` in `index.js`, which is the default entry when you do `require('vue-i18n')`.

For example, to build `compiler` with the global build only:

```bash
Expand All @@ -117,7 +112,7 @@ pnpm build -- message-compiler -f global
Multiple formats can be specified as a comma-separated list:

```bash
pnpm build -- message-compiler -f esm-browser,cjs
pnpm build -- message-compiler -f esm-browser,global
```

#### Build with Source Maps
Expand Down
14 changes: 0 additions & 14 deletions docs/guide/extra/dist.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to remove for cjs, but vue-i18n docs have to support v9 - v12.
So, We need to mention for cjs dropping on v12 as important tip.

Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,10 @@ If you use `vue-i18n.runtime.esm-bundler.js`, you will need to precompile all lo

## For Node.js (Server-Side)

- **`vue-i18n.cjs(.prod).js`**:
- For CommonJS usage in Node.js
- For use in Node.js via `require()`
- If you bundle your app with webpack with `target: 'node'` and properly externalize `vue-i18n`, this is the build that will be loaded
- The dev/prod files are pre-built, but the appropriate file is automatically required based on `process.env`<wbr/>`.NODE_ENV`

:::tip Support Version
:new: 9.3+
:::

- **`vue-i18n(.runtime).node.mjs`**:
- For ES Modules usage in Node.js
- For use in Node.js via `import`
- The dev/prod files are pre-built, but the appropriate file is automatically required based on `process.env`<wbr/>`.NODE_ENV`
- This module is proxy module of `vue-i18n(.runtime).mjs`
- **`vue-i18n.runtime.node.mjs`**: is runtime only.
- **`vue-i18n.node.mjs`**: includes the runtime compiler.

:::tip NOTE
ES Modules will be the future of the Node.js module system. The `vue-i18n.cjs(.prod).js` will be deprecated in the future. We recommend you would use `vue-i18n(.runtime).node.mjs`.
:::
3 changes: 1 addition & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default [
}
},
{
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
files: ['**/*.js', '**/*.mjs'],
...ts.configs.disableTypeChecked
},

Expand Down Expand Up @@ -95,7 +95,6 @@ export default [
'shim.d.ts',
'temp/**',
'.eslintcache',
'.eslintrc.cjs',
'packages/*/vite.config.ts',
'packages/*/index.js',
'packages/vue-i18n-core/petite.js',
Expand Down
7 changes: 0 additions & 7 deletions packages/core-base/index.js

This file was deleted.

10 changes: 1 addition & 9 deletions packages/core-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
"url": "https://github.com/intlify/vue-i18n/issues"
},
"files": [
"index.js",
"dist"
],
"main": "index.js",
"module": "dist/core-base.mjs",
"unpkg": "dist/core-base.global.js",
"jsdelivr": "dist/core-base.global.js",
Expand All @@ -47,7 +45,6 @@
"formats": [
"mjs",
"browser",
"cjs",
"global"
]
},
Expand All @@ -58,14 +55,9 @@
"browser": "./dist/core-base.esm-browser.js",
"node": {
"import": {
"production": "./dist/core-base.prod.cjs",
"production": "./dist/core-base.prod.mjs",
"development": "./dist/core-base.mjs",
"default": "./dist/core-base.mjs"
},
"require": {
"production": "./dist/core-base.prod.cjs",
"development": "./dist/core-base.cjs",
"default": "./index.js"
}
}
},
Expand Down
9 changes: 0 additions & 9 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ The intlify core module for i18n

### For Node.js (Server-Side)

- **`core.cjs(.prod).js`**:
- For CommonJS usage in Node.js
- For use in Node.js via `require()`
- If you bundle your app with webpack with `target: 'node'` and properly externalize `@intlify/core`, this is the build that will be loaded
- The dev/prod files are pre-built, but the appropriate file is automatically required based on `process.env.NODE_ENV`

- **`core(.runtime).node.mjs`**:
- For ES Moudles usage in Node.js
- For use in Node.js via `import`
Expand All @@ -50,9 +44,6 @@ The intlify core module for i18n
- **`core.runtime.node.mjs`**: is runtime only. proxy `core.runtime.mjs`
- **`core.node.mjs`**: includes the runtime compiler. proxy `core.mjs`

> NOTE: ES Modules will be the future of the Node.js module system. The `core.cjs(.prod).js` will be deprecated in the future. We recommend you would use `core(.runtime).node.mjs`. 9.3+


## :copyright: License

[MIT](http://opensource.org/licenses/MIT)
7 changes: 0 additions & 7 deletions packages/core/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
"url": "https://github.com/intlify/vue-i18n/issues"
},
"files": [
"index.js",
"dist"
],
"main": "index.js",
"module": "dist/core.mjs",
"unpkg": "dist/core.global.js",
"jsdelivr": "dist/core.global.js",
Expand All @@ -48,7 +46,6 @@
"mjs-node-runtime",
"browser",
"browser-runtime",
"cjs",
"global",
"global-runtime"
]
Expand All @@ -63,11 +60,6 @@
"production": "./dist/core.prod.node.mjs",
"development": "./dist/core.node.mjs",
"default": "./dist/core.node.mjs"
},
"require": {
"production": "./dist/core.prod.cjs",
"development": "./dist/core.cjs",
"default": "./index.js"
}
}
},
Expand Down
7 changes: 0 additions & 7 deletions packages/devtools-types/index.js

This file was deleted.

12 changes: 2 additions & 10 deletions packages/devtools-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
"url": "https://github.com/intlify/vue-i18n/issues"
},
"files": [
"index.js",
"dist"
],
"main": "index.js",
"module": "dist/devtools-types.mjs",
"types": "dist/devtools-types.d.ts",
"dependencies": {
Expand All @@ -39,8 +37,7 @@
"buildOptions": {
"name": "IntlifyDevToolsTypes",
"formats": [
"mjs",
"cjs"
"mjs"
]
},
"exports": {
Expand All @@ -49,14 +46,9 @@
"import": "./dist/devtools-types.mjs",
"node": {
"import": {
"production": "./dist/devtools-types.prod.cjs",
"production": "./dist/devtools-types.prod.mjs",
"development": "./dist/devtools-types.mjs",
"default": "./dist/devtools-types.mjs"
},
"require": {
"production": "./dist/devtools-types.prod.cjs",
"development": "./dist/devtools-types.cjs",
"default": "./index.js"
}
}
},
Expand Down
7 changes: 0 additions & 7 deletions packages/message-compiler/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/message-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
"url": "https://github.com/intlify/vue-i18n/issues"
},
"files": [
"index.js",
"dist"
],
"main": "index.js",
"module": "dist/message-compiler.mjs",
"unpkg": "dist/message-compiler.global.js",
"jsdelivr": "dist/message-compiler.global.js",
Expand All @@ -45,7 +43,6 @@
"mjs",
"mjs-node",
"browser",
"cjs",
"global"
],
"enableFullBundleForEsmBrowser": true
Expand All @@ -60,11 +57,6 @@
"production": "./dist/message-compiler.node.mjs",
"development": "./dist/message-compiler.node.mjs",
"default": "./dist/message-compiler.node.mjs"
},
"require": {
"production": "./dist/message-compiler.prod.cjs",
"development": "./dist/message-compiler.cjs",
"default": "./index.js"
}
}
},
Expand Down
7 changes: 0 additions & 7 deletions packages/petite-vue-i18n/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/petite-vue-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
"url": "https://github.com/intlify/vue-i18n/issues"
},
"files": [
"index.js",
"dist"
],
"main": "index.js",
"module": "dist/petite-vue-i18n.mjs",
"unpkg": "dist/petite-vue-i18n.global.js",
"jsdelivr": "dist/petite-vue-i18n.global.js",
Expand Down Expand Up @@ -58,7 +56,6 @@
"mjs-node-runtime",
"browser",
"browser-runtime",
"cjs",
"global",
"global-runtime"
]
Expand All @@ -73,11 +70,6 @@
"production": "./dist/petite-vue-i18n.node.mjs",
"development": "./dist/petite-vue-i18n.node.mjs",
"default": "./dist/petite-vue-i18n.node.mjs"
},
"require": {
"production": "./dist/petite-vue-i18n.prod.cjs",
"development": "./dist/petite-vue-i18n.cjs",
"default": "./index.js"
}
}
},
Expand Down
7 changes: 0 additions & 7 deletions packages/shared/index.js

This file was deleted.

11 changes: 1 addition & 10 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
"url": "https://github.com/intlify/vue-i18n/issues"
},
"files": [
"index.js",
"dist"
],
"main": "index.js",
"module": "dist/shared.mjs",
"types": "dist/shared.d.ts",
"engines": {
Expand All @@ -36,8 +34,7 @@
"name": "IntlifyShared",
"formats": [
"mjs",
"browser",
"cjs"
"browser"
]
},
"exports": {
Expand All @@ -47,14 +44,8 @@
"browser": "./dist/shared.esm-browser.js",
"node": {
"import": {
"production": "./dist/shared.prod.cjs",
"development": "./dist/shared.mjs",
"default": "./dist/shared.mjs"
},
"require": {
"production": "./dist/shared.prod.cjs",
"development": "./dist/shared.cjs",
"default": "./index.js"
}
}
},
Expand Down
7 changes: 0 additions & 7 deletions packages/vue-i18n-core/index.js

This file was deleted.

15 changes: 0 additions & 15 deletions packages/vue-i18n-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
"url": "https://github.com/intlify/vue-i18n/issues"
},
"files": [
"index.js",
"dist"
],
"main": "index.js",
"module": "dist/vue-i18n-core.mjs",
"unpkg": "dist/vue-i18n-core.global.js",
"jsdelivr": "dist/vue-i18n-core.global.js",
Expand All @@ -53,7 +51,6 @@
"formats": [
"mjs",
"browser",
"cjs",
"global"
]
},
Expand All @@ -64,14 +61,8 @@
"browser": "./dist/vue-i18n-core.esm-browser.js",
"node": {
"import": {
"production": "./dist/vue-i18n-core.prod.cjs",
"development": "./dist/vue-i18n-core.mjs",
"default": "./dist/vue-i18n-core.mjs"
},
"require": {
"production": "./dist/vue-i18n-core.prod.cjs",
"development": "./dist/vue-i18n-core.cjs",
"default": "./index.js"
}
}
},
Expand All @@ -81,14 +72,8 @@
"browser": "./dist/petite-vue-i18n-core.esm-browser.js",
"node": {
"import": {
"production": "./petite-dist/vue-i18n-core.prod.cjs",
"development": "./petite-dist/vue-i18n-core.mjs",
"default": "./dist/petite-vue-i18n-core.mjs"
},
"require": {
"production": "./dist/petite-vue-i18n-core.prod.cjs",
"development": "./dist/petite-vue-i18n-core.cjs",
"default": "./petite.js"
}
}
},
Expand Down
7 changes: 0 additions & 7 deletions packages/vue-i18n-core/petite.js

This file was deleted.

Loading
Loading