File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -282,6 +282,7 @@ export async function withLingo(
282282 translationServerUrl,
283283 ...lingoConfig . dev ,
284284 } ,
285+ isEmbeddedIntoNext : true ,
285286 } ) ,
286287 ) ;
287288
Original file line number Diff line number Diff line change 1111 */
1212import { createUnplugin } from "unplugin" ;
1313import { transformComponent } from "./transform" ;
14- import type { PartialLingoConfig } from "../types" ;
14+ import type {
15+ LingoConfig ,
16+ LingoInternalFields ,
17+ PartialLingoConfig ,
18+ } from "../types" ;
1519import {
1620 startTranslationServer ,
1721 type TranslationServer ,
@@ -44,7 +48,9 @@ const PLUGIN_NAME = "lingo-compiler";
4448 * Universal plugin for Lingo.dev compiler
4549 * Supports Vite, Webpack, Rollup, and esbuild
4650 */
47- export const lingoUnplugin = createUnplugin < LingoPluginOptions > ( ( options ) => {
51+ export const lingoUnplugin = createUnplugin <
52+ LingoPluginOptions & Pick < LingoConfig , LingoInternalFields >
53+ > ( ( options ) => {
4854 const config = createLingoConfig ( options ) ;
4955
5056 // Won't work for webpack most likely. Use mode there to set correct environment in configs.
@@ -112,9 +118,9 @@ export const lingoUnplugin = createUnplugin<LingoPluginOptions>((options) => {
112118 } ,
113119
114120 webpack ( compiler ) {
115- // if (config.isEmbeddedIntoNext) {
116- // return;
117- // }
121+ if ( config . isEmbeddedIntoNext ) {
122+ return ;
123+ }
118124
119125 webpackMode =
120126 compiler . options . mode === "development" ? "development" : "production" ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export type LocalePersistenceConfig = { type: "cookie"; cookieName?: string };
3232 */
3333export type LingoConfigRequiredFields = "sourceLocale" | "targetLocales" ;
3434
35- export type LingoInternalFields = "environment" ;
35+ export type LingoInternalFields = "environment" | "isEmbeddedIntoNext" ;
3636
3737/**
3838 * Configuration for the Lingo compiler
@@ -198,6 +198,8 @@ export type LingoConfig = {
198198 * @default "translate"
199199 */
200200 buildMode : "translate" | "cache-only" ;
201+
202+ isEmbeddedIntoNext : boolean ;
201203} ;
202204
203205/**
You can’t perform that action at this time.
0 commit comments