https://github.com/webdeveric/esbuild-plugin-define
esbuild plugin to define global identifiers
https://github.com/webdeveric/esbuild-plugin-define
esbuild-plugin plugin
Last synced: 4 months ago
JSON representation
esbuild plugin to define global identifiers
- Host: GitHub
- URL: https://github.com/webdeveric/esbuild-plugin-define
- Owner: webdeveric
- License: mit
- Created: 2022-11-20T19:49:53.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-12-25T00:02:31.000Z (5 months ago)
- Last Synced: 2024-12-25T01:19:01.101Z (5 months ago)
- Topics: esbuild-plugin, plugin
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/esbuild-plugin-define
- Size: 524 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# `esbuild-plugin-define`
[](https://github.com/webdeveric/esbuild-plugin-define/actions)
## Install
```sh
npm install esbuild-plugin-define -D
```## Usage
Add the plugin to your esbuild `plugins`.
Example `esbuild.config.cjs` file:
```js
const { definePlugin } = require('esbuild-plugin-define');module.exports = () => {
const config = {
bundle: true,
sourcemap: true,
platform: 'node',
target: 'es2022',
format: 'esm',
outputFileExtension: '.mjs',
define: {},
concurrency: 4,
watch: {
pattern: ['./src/**'],
ignore: ['dist', 'node_modules'],
},
plugins: [
definePlugin({
process: {
env: {
BUILD_TIMESTAMP: new Date().toISOString(),
},
},
}),
],
};return config;
};
```