fix the production build issues (#1001)
This commit is contained in:
1 parent
08757ef767
commit
ab4feb524d
61 files changed
+217
-98
No files matched your search
@@ -62,4 +62,12 @@ export default defineConfig({
|
||||
allow: [workspaceRoot],
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
dedupe: [
|
||||
"react",
|
||||
"react-dom",
|
||||
"@preact/signals-core",
|
||||
"@preact/signals-react"
|
||||
],
|
||||
},
|
||||
});
|
||||
@@ -2,6 +2,7 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -31,7 +32,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: []
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
}));
|
||||
@@ -2,6 +2,7 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -31,7 +32,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: []
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -31,7 +32,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: []
|
||||
external: isExternal
|
||||
},
|
||||
// NB(bt,2025-09-25): This mangling config doesn't seem like it works:
|
||||
//terserOptions: {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
cacheDir: '../../node_modules/.vite/libs/build-env',
|
||||
plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') }), ],
|
||||
plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })],
|
||||
// Uncomment this if you are using workers.
|
||||
// worker: {
|
||||
// plugins: [ nxViteTsPaths() ],
|
||||
@@ -15,23 +15,21 @@ export default defineConfig(() => ({
|
||||
// Configuration for building your library.
|
||||
// See: https://vitejs.dev/guide/build.html#library-mode
|
||||
build: {
|
||||
'emptyOutDir': true,
|
||||
'transformMixedEsModules': true,
|
||||
'entry': 'src/index.ts',
|
||||
'name': '@frontend/build-env',
|
||||
'fileName': 'index',
|
||||
'formats': ['es' as const],
|
||||
'external': ['react','react-dom','react/jsx-runtime'],
|
||||
'lib': {
|
||||
'entry': "src/index.ts",
|
||||
'name': "@frontend/build-env",
|
||||
'fileName': "index",
|
||||
'formats': ['es' as const],
|
||||
outDir: './dist',
|
||||
emptyOutDir: true,
|
||||
reportCompressedSize: true,
|
||||
commonjsOptions: {
|
||||
transformMixedEsModules: true,
|
||||
},
|
||||
lib: {
|
||||
entry: 'src/index.ts',
|
||||
name: '@frontend/build-env',
|
||||
fileName: 'index',
|
||||
formats: ['es' as const],
|
||||
},
|
||||
rollupOptions: {
|
||||
external: isExternal
|
||||
},
|
||||
'rollupOptions': {"external":["'react'","'react-dom'","'react/jsx-runtime'"]},
|
||||
'outDir': "./dist",
|
||||
'reportCompressedSize': true,
|
||||
'commonjsOptions': {"transformMixedEsModules":true},
|
||||
},
|
||||
test: {
|
||||
'watch': false,
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react', 'react-dom', 'react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,8 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
// Uses shared config to externalize React, @preact/signals-*, and @storyteller/* packages
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,8 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
// Uses shared config to externalize React, @preact/signals-*, and @storyteller/* packages
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
{
|
||||
"path": "../../model-list"
|
||||
},
|
||||
{
|
||||
"path": "../action-reminder-modal"
|
||||
},
|
||||
{
|
||||
"path": "../toaster"
|
||||
},
|
||||
|
||||
@@ -49,6 +49,9 @@
|
||||
{
|
||||
"path": "../../model-list/tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "../action-reminder-modal/tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "../toaster/tsconfig.lib.json"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,8 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
// Uses shared config to externalize React, @preact/signals-*, and @storyteller/* packages
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -38,7 +39,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,8 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
// Uses shared config to externalize React, @preact/signals-*, and @storyteller/* packages
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,8 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
// Uses shared config to externalize React, @preact/signals-*, and @storyteller/* packages
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import dts from "vite-plugin-dts";
|
||||
import * as path from "path";
|
||||
import { isExternal } from "../../shared-vite-config";
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -38,7 +39,8 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ["react", "react-dom", "react/jsx-runtime", /@storyteller\/.*/],
|
||||
// Uses shared config to externalize React, @preact/signals-*, and @storyteller/* packages
|
||||
external: isExternal,
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,15 +3,16 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
cacheDir: '../../../node_modules/.vite/libs/components/toaster',
|
||||
plugins: [
|
||||
react(),
|
||||
dts({
|
||||
entryRoot: 'src',
|
||||
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json')
|
||||
react(),
|
||||
dts({
|
||||
entryRoot: 'src',
|
||||
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json')
|
||||
})
|
||||
],
|
||||
// Uncomment this if you are using workers.
|
||||
@@ -38,12 +39,8 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: [
|
||||
'react',
|
||||
'react-dom',
|
||||
'react/jsx-runtime',
|
||||
'react-hot-toast'
|
||||
],
|
||||
// Uses shared config plus react-hot-toast
|
||||
external: isExternal,
|
||||
output: {
|
||||
globals: {
|
||||
'react-hot-toast': 'react-hot-toast',
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ formats: ['es' as const]
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {setupFiles: ['./src/test-setup.ts'],
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,13 +33,8 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: [
|
||||
'react',
|
||||
'react-dom',
|
||||
'react/jsx-runtime',
|
||||
'react-router-dom',
|
||||
/^@fortawesome\/.*/
|
||||
]
|
||||
// Uses shared config plus react-router-dom and @fortawesome
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -31,7 +32,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: []
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Shared Vite configuration for library builds.
|
||||
*
|
||||
* This ensures that:
|
||||
* 1. React is always externalized (peer dependency)
|
||||
* 2. @preact/signals-* packages are externalized to prevent duplicate state
|
||||
* 3. @storyteller/* workspace packages are externalized so libraries don't bundle each other
|
||||
*
|
||||
* Without this, stateful modules like signals get bundled multiple times,
|
||||
* causing state isolation issues in production builds.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns true if the given module ID should be externalized during library builds.
|
||||
*/
|
||||
export function isExternal(id: string): boolean {
|
||||
// Always externalize React
|
||||
if (
|
||||
id === 'react' ||
|
||||
id === 'react-dom' ||
|
||||
id === 'react/jsx-runtime' ||
|
||||
id.startsWith('react/') ||
|
||||
id.startsWith('react-dom/')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Other react libraries
|
||||
if (
|
||||
id === 'react-hot-toast' ||
|
||||
id === 'react-router-dom' ||
|
||||
id.startsWith('react-')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Externalize @preact/signals to prevent duplicate signal state
|
||||
if (id.startsWith('@preact/signals')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Other important libraries
|
||||
if (
|
||||
id === 'konva' ||
|
||||
id === 'three' ||
|
||||
id === 'zustand' ||
|
||||
id.startsWith('@fortawesome/')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Externalize all workspace packages so libraries don't bundle each other
|
||||
if (id.startsWith('@storyteller/') || id.startsWith('@frontend/')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ formats: ['es' as const]
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {setupFiles: ['./src/test-setup.ts'],
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ formats: ['es' as const]
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {setupFiles: ['./src/test-setup.ts'],
|
||||
|
||||
@@ -3,15 +3,16 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
cacheDir: '../../node_modules/.vite/libs/tauri-events',
|
||||
plugins: [
|
||||
react(),
|
||||
dts({
|
||||
entryRoot: 'src',
|
||||
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json')
|
||||
react(),
|
||||
dts({
|
||||
entryRoot: 'src',
|
||||
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json')
|
||||
})
|
||||
],
|
||||
// Uncomment this if you are using workers.
|
||||
@@ -38,12 +39,8 @@ export default defineConfig(() => ({
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: [
|
||||
'react',
|
||||
'react-dom',
|
||||
'react/jsx-runtime',
|
||||
'react-hot-toast',
|
||||
]
|
||||
// Uses shared config plus react-hot-toast
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import dts from 'vite-plugin-dts';
|
||||
import * as path from 'path';
|
||||
import { isExternal } from '../shared-vite-config';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
@@ -32,7 +33,7 @@ formats: ['es' as const]
|
||||
},
|
||||
rollupOptions: {
|
||||
// External packages that should not be bundled into your library.
|
||||
external: ['react','react-dom','react/jsx-runtime']
|
||||
external: isExternal
|
||||
},
|
||||
},
|
||||
test: {setupFiles: ['./src/test-setup.ts'],
|
||||
|
||||
Reference in new issue
Block a user