diff --git a/core-web/libs/sdk/analytics/project.json b/core-web/libs/sdk/analytics/project.json index 55cb99f92bb..d9314c57a31 100644 --- a/core-web/libs/sdk/analytics/project.json +++ b/core-web/libs/sdk/analytics/project.json @@ -11,6 +11,17 @@ "options": { "jestConfig": "libs/sdk/analytics/jest.config.ts" } + }, + "build:standalone": { + "executor": "@nx/vite:build", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "../../core/dotCMS/src/main/resources/ca/html", + "main": "libs/sdk/analytics/src/lib/standalone.ts", + "tsConfig": "libs/sdk/analytics/tsconfig.lib.json", + "project": "libs/sdk/analytics/package.json", + "configFile": "libs/sdk/analytics/vite.standalone.config.mts" + } } } } diff --git a/core-web/libs/sdk/analytics/vite.standalone.config.ts b/core-web/libs/sdk/analytics/vite.standalone.config.mts similarity index 67% rename from core-web/libs/sdk/analytics/vite.standalone.config.ts rename to core-web/libs/sdk/analytics/vite.standalone.config.mts index b06c8d97141..958873c2c79 100644 --- a/core-web/libs/sdk/analytics/vite.standalone.config.ts +++ b/core-web/libs/sdk/analytics/vite.standalone.config.mts @@ -6,10 +6,10 @@ import { resolve } from 'path'; export default defineConfig({ root: __dirname, - cacheDir: '../../../node_modules/.vite/libs/sdk/sdk-analytics-3', + cacheDir: '../../../node_modules/.vite/libs/sdk/analytics', plugins: [nxViteTsPaths()], build: { - outDir: '../../../dist/libs/sdk/sdk-analytics-3', + outDir: '../../../dist/libs/sdk/analytics', emptyOutDir: false, reportCompressedSize: true, lib: { @@ -19,8 +19,10 @@ export default defineConfig({ formats: ['iife'] }, rollupOptions: { + external: ['react', 'react-dom', 'react/jsx-runtime', /^@dotcms\/analytics\/react/], output: { - entryFileNames: 'ca.min.js' + entryFileNames: 'ca.min.js', + globals: {} } } }