Lines 1-41javascript
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.defaultSearchRoots = void 0;
4exports.resolveCssInjectedByJsPluginEntry = resolveCssInjectedByJsPluginEntry;
5exports.loadCssInjectedByJsPlugin = loadCssInjectedByJsPlugin;
6const tslib_1 = require("tslib");
8 * Indirect loader for `vite-plugin-css-injected-by-js` (ESM-only since v5).
10 * ## Why this file exists
12 * 1. Iris remotes must inject CSS into the JS bundle. The host iframe's CSP
13 * blocks external stylesheets, so a separate `.css` file leaves the app
14 * unstyled. Vite 8/Rolldown stopped emitting CSS the way Rollup did, so we
15 * need this plugin (v5+) to inline it.
16 * 2. The plugin only publishes an `import` export condition. A plain
17 * `import … from "vite-plugin-css-injected-by-js"` (or a static `require`)
18 * fails under Nx's CJS executor hooks, which rewrite dynamic `import()` into
19 * `require()` and hit `ERR_PACKAGE_PATH_NOT_EXPORTED`.
21 * This module therefore resolves the package's ESM entry from its manifest and
22 * loads it via an indirect `new Function("return import(...)")` so Node really
23 * does an ESM import.
LowEval
Package source references a known benign dynamic code generation pattern.
src/executors/utils/loadCssInjectedByJsPlugin.jsView on unpkg · L21 25 * ## When to delete this file
27 * Replace the call site in `getTrackunitIrisAppVitePlugins.ts` with a normal
28 * `import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js"` and
29 * delete this module once **all** of the following are true:
31 * - Nx executors for this package run as native ESM (no CJS rewrite of
32 * `import()`), **or** the plugin ships a CJS/`require` export again; and
33 * - A plain static import of the plugin works inside
34 * `yarn nx build <any-iris-app>` (Iris apps still load with styles).
36 * Until then, do not "simplify" this back to a static import — that is the
37 * regression that left Iris apps blank after the Vite 8 upgrade.
39const fs = tslib_1.__importStar(require("node:fs"));
40const path = tslib_1.__importStar(require("node:path"));
41const node_url_1 = require("node:url");