chromatic-cli
chromatic-cli copied to clipboard
ReferenceError: process is not defined
I see this error when I include build configuration for my npm package.
✖ Failed to extract stories from your Storybook
This is usually a problem with your published Storybook, not with Chromatic.
Build and open your Storybook locally and check the browser console for errors.
Visit your published Storybook at https://6411a222f5925f939069a362-uuwmxfgzxo.chromatic.com/
The following error was encountered while running your Storybook:
ReferenceError: process is not defined
The error doesn't seem to give much information but rather just show that there's an error.
I found out that this occurs when I include the below configuration to vite.config.ts
.
/// <reference types="vitest" />
import react from '@vitejs/plugin-react'
import path from 'path'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import tsconfigPaths from 'vite-tsconfig-paths'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
tsconfigPaths(),
react(),
dts({
insertTypesEntry: true
})
],
test: {
globals: true,
environment: 'jsdom',
watch: true,
setupFiles: './__test__/setup.js',
reporters: 'verbose',
include: ['**/*.test.tsx'],
cache: false
},
// With this build configuration I get an error
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'index',
formats: ['es', 'umd'],
fileName: format => `index.${format}.js`
},
rollupOptions: {
external: ['react', 'react-dom'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM'
}
}
}
}
})
I'm not sure how chromatic
relates to vite configuration but it doesn't like the config above.
https://github.com/SwimmingPolar/sp-date-picker
This is the package I tried to deploy with chromatic cli.