-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Export configured Vite plugins from
packages/build
(#43847)
* Move `cspPlugin` to teleterm * Keep `reactPlugin` config in `build/vite` * Keep `tsconfigPathsPlugin` config in `build/vite` * Add a comment about .mjs * Lint * `resolve` -> `path.resolve` * Convert arrow function to regular function
- Loading branch information
Showing
5 changed files
with
105 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Teleport | ||
* Copyright (C) 2024 Gravitational, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/** | ||
* This needs to be an .mjs file, | ||
* because Vite can't import .ts files from a workspace out of the box. | ||
* https://github.com/vitejs/vite/issues/5370 | ||
*/ | ||
|
||
import path from 'node:path'; | ||
|
||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
|
||
const rootDirectory = path.resolve(import.meta.dirname, '../../../..'); | ||
|
||
export function tsconfigPathsPlugin() { | ||
return tsconfigPaths({ | ||
// Asking vite to crawl the root directory (by defining the `root` object, rather than `projects`) causes vite builds to fail | ||
// with a: | ||
// | ||
// "Error: ENOTDIR: not a directory, scandir '/go/src/github.com/gravitational/teleport/docker/ansible/rdir/rdir/rdir'"" | ||
// | ||
// on a Debian GNU/Linux 10 (buster) (buildbox-node) Docker image running on an arm64 Macbook macOS 14.1.2. It's not clear why | ||
// this happens, however, defining the tsconfig file directly works around the issue. | ||
projects: [path.resolve(rootDirectory, 'tsconfig.json')], | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters