- Published on
- • 2 min read
compiler v1.0.0 + gt-next@6.7.0
- Authors
 - Name
- Ernest McCarter
- Software Engineer
 
 
Reading Time
2 min read
Overview
We are very excited to announce the release of @general-translation/compiler v1.0.0.
As we stated in our gt-next@6.2.0 release, we believe the future of i18n libraries lies in build-time processing. Earlier this year, we released a SWC plugin for gt-next that enabled optimizations like compile-time hashing and better dev-time string translations. While this provided an excellent (albeit intense) introduction to compiler plugins for our team, its scope was limited to Next.js projects only.
We're following through on our commitment to build-time processing by releasing this general-purpose React compiler plugin. This means all the build-time optimizations from gt-next are now available to every gt-react user!
Setup
Configuration
| Option | Type | Default | Description | 
|---|---|---|---|
| compileTimeHash | boolean | true | Enables compile-time hashing | 
| disableBuildChecks | boolean | false | Disables error throwing when invalid library usage is detected | 
| logLevel | string | 'warn' | Controls the level of logging. Options: 'silent'|'error'|'warn'|'info'|'debug' | 
Note: For gt-next, in order to satisfy a backward compatibility requirement, if you set compileTimeHash to false, the entire plugin will be disabled.
gt-react
You first need to install the package:
npm install @generaltranslation/compiler
Vite
// vite.config.js
import { defineConfig } from 'vite'
import { vite as gtCompiler } from '@generaltranslation/compiler'
export default defineConfig({
  plugins: [gtCompiler()],
})
Webpack
// webpack.config.js
const { webpack: gtCompiler } = require('@generaltranslation/compiler')
module.exports = {
  plugins: [gtCompiler()],
}
Rollup
// rollup.config.js
import { rollup as gtCompiler } from '@generaltranslation/compiler'
export default {
  plugins: [gtCompiler()],
}
gt-next
You do not need to install any additional packages.
For gt-next, we're deprecating experimentalSwcPluginOptions in favor of the new experimentalCompilerOptions field. The key difference is that you must now specify which compiler type to use: 'swc' or 'babel'. The 'swc' compiler is used by default, but you can enable the new Babel-based compiler by setting the type field to 'babel'.
// next.config.js
import { withGTConfig } from 'gt-next'
export default withGTConfig(nextConfig, {
  experimentalCompilerOptions: {
    type: 'babel',
  },
})
Conclusion
We have much more work planned for the compiler, so expect frequent updates in the coming months.