From c1556ac500eaa0a27adbf8e88ea3bd7a2e46707d Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 10 Sep 2025 20:10:23 -0700 Subject: [PATCH] feat: vite support --- nativescript.vite.mjs | 22 ++++++++++++++++++++++ package.json | 1 + 2 files changed, 23 insertions(+) create mode 100644 nativescript.vite.mjs diff --git a/nativescript.vite.mjs b/nativescript.vite.mjs new file mode 100644 index 0000000..11007be --- /dev/null +++ b/nativescript.vite.mjs @@ -0,0 +1,22 @@ +import { createRequire } from "module"; +const require = createRequire(import.meta.url); + +let postcssConfig = "./postcss.config.js"; + +try { + const twV4 = require("@tailwindcss/postcss"); + const nsTailwind = require("@nativescript/tailwind"); + postcssConfig = { plugins: [twV4, nsTailwind] }; +} catch (e2) { + console.warn( + "Inline PostCSS unavailable, falling back to ./postcss.config.js" + ); +} + +export default () => { + return { + css: { + postcss: postcssConfig, + }, + }; +}; diff --git a/package.json b/package.json index 7b47a8d..2ee39ad 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "src/index.js", "files": [ "src", + "nativescript.vite.mjs", "nativescript.webpack.js" ], "repository": "https://github.com/NativeScript/tailwind",