![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@woomai/unplugin-info
Advanced tools
Export build information as virutal module.
This plugin helps you add build timestamp / commit SHA / ... to your application. So you can easily check whether the production version meets your expectations.
This pacakge was originally named vite-plugin-info. Now it has been refactored using unplugin to support more tools.
However, you can still use vite-plugin-info since it works fine. Thanks to the compatibility of Vite. And the source code of vite-plugin-info is here.
npm i -D unplugin-info
// vite.config.ts
import Info from 'unplugin-info/vite';
export default defineConfig({
plugins: [
Info()
]
});
// rollup.config.js
import Info from 'unplugin-info/rollup';
export default {
plugins: [
Info()
]
};
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-info/webpack')()
]
};
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['unplugin-info/nuxt']
});
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-info/webpack')()
]
}
};
// quasar.conf.js [Vite]
module.exports = {
vitePlugins: [
[
'unplugin-info/vite',
{
/* options */
}
]
]
};
// quasar.conf.js [Webpack]
const Info = require('unplugin-info/webpack');
module.exports = {
build: {
chainWebpack(chain) {
chain.plugin('unplugin-info').use(
Info()
);
}
}
};
// esbuild.config.js
import { build } from 'esbuild';
build({
/* ... */
plugins: [
require('unplugin-info/esbuild')({
/* options */
}),
],
});
// astro.config.mjs
import Info from 'unplugin-info/astro';
export default defineConfig({
integrations: [
Info()
],
});
unplugin-info
creates three virtual modules, ~build/time
, ~build/info
, and ~build/meta
.
It exports the timestamp when the vite started.
import now from '~build/time'
console.log(now)
// There will be a log like "Fri Jun 24 2022 16:30:30 GMT+0800 (中国标准时间)"
It exports the infomation about the current git repo. This is powered by git-repo-info and ci-info.
import {
CI,
github,
sha,
abbreviatedSha,
tag,
lastTag,
commitsSinceLastTag,
committer,
committerDate,
author,
authorDate,
commitMessage
} from '~build/info';
// ...
It exports some meta data from the options of the plugin.
// vite.config.ts
export default defineConfig({
plugins: [
BuildInfo({
meta: { message: 'This is set from vite.config.ts' }
})
]
})
Then you can import them in your Vite app.
import { message } from '~build/meta'
console.log(message)
// This is set from vite.config.ts
Note
Meta data will be serialized to JSON format, so you should gen it in you
vite.config.ts
and pass the result object.
To get TypeScript support, you can add type declaration in your env.d.ts
(It is include in the official Vite project template).
declare module '~build/meta' {
export const message: string;
}
It exports the information of the current package.json
.
import { name, version } from '~build/package';
MIT License © 2023 XLor
FAQs
Export build information as virutal module
We found that @woomai/unplugin-info demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.