Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…b-monorepo into PORTALS-3241
  • Loading branch information
jay-hodgson committed Sep 19, 2024
2 parents c624b9f + a039ef5 commit 0de7a61
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 43 deletions.
18 changes: 10 additions & 8 deletions packages/markdown-it-synapse/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { vitestConfig } from 'vite-config'
import { mergeConfig } from 'vitest/config'
import { ConfigBuilder } from 'vite-config'

export default mergeConfig(vitestConfig, {
test: {
globals: true,
include: ['test/**/*.test.[jt]s?(x)'],
},
})
export default new ConfigBuilder()
.setIncludeVitestConfig(true)
.setConfigOverrides({
test: {
globals: true,
include: ['test/**/*.test.[jt]s?(x)'],
},
})
.build()
4 changes: 2 additions & 2 deletions packages/vite-config/src/ConfigBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getPluginConfig, PluginConfigOptions } from './pluginConfig.js'
import viteConfig from './vite-config.js'
import baseConfig from './baseConfig.js'
import { mergeConfig } from 'vitest/config'
import viteLibraryConfig from './vite-library-config.js'
import vitestConfig from './vitest-config.js'
Expand Down Expand Up @@ -45,7 +45,7 @@ export class ConfigBuilder {
}

build() {
let config = viteConfig
let config = baseConfig
if (this.includeLibraryConfig) {
if (!this.buildLibEntry) {
throw new Error(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
import react from '@vitejs/plugin-react'
import { resolve, dirname } from 'path'
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
import { defineConfig, UserConfig } from 'vite'
import svgr from 'vite-plugin-svgr'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import { fileURLToPath } from 'url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

export const config: UserConfig = {
/**
* Vite config properties that are shared across all Vite configurations.
*/
const baseConfig: UserConfig = defineConfig({
server: { port: 3000 },
build: {
outDir: './build',
commonjsOptions: {
transformMixedEsModules: true,
},
},
plugins: [
react(),
svgr({
svgrOptions: {
plugins: ['@svgr/plugin-jsx'],
ref: true,
exportType: 'named',
},
// Explicitly exclude SVG imports that end in a query (such as ?url) - Vite can already handle these
include: /^.*\.svg$/,
}),
nodePolyfills(),
],
plugins: [nodePolyfills()],
define: {
__TEST__: JSON.stringify(false),
__DEV__: JSON.stringify(false),
Expand Down Expand Up @@ -58,6 +47,6 @@ export const config: UserConfig = {
util: 'util',
},
},
}
})

export default defineConfig(config)
export default baseConfig
15 changes: 2 additions & 13 deletions packages/vite-config/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import viteConfig from './vite-config.js'
import vitestConfig from './vitest-config.js'
import portalsViteConfig from './portals-vite-config.js'
import viteLibraryConfig from './vite-library-config.js'
import { ConfigBuilder } from './ConfigBuilder.js'
import portalsViteConfig from './portals-vite-config.js'

export {
viteConfig,
vitestConfig,
portalsViteConfig,
viteLibraryConfig,
ConfigBuilder,
}

export default viteConfig
export { portalsViteConfig, ConfigBuilder }

0 comments on commit 0de7a61

Please sign in to comment.