Skip to content

Commit

Permalink
chore: support cjs in all sourcecode that is not external
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebodin committed Sep 12, 2024
1 parent 780b377 commit 9dcd4a3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 1 addition & 4 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
"initialVersions": {
"@strapi/pack-up": "5.0.0"
},
"changesets": [
"four-games-camp",
"red-frogs-cry"
]
"changesets": ["four-games-camp", "red-frogs-cry"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@strapi/pack-up",
"version": "5.0.1-alpha.1",
"version": "0.0.0-experimental.d0238c20f2d2af79a77b594f297c7380a46dfe33",
"description": "Simple tools for creating interoperable CJS & ESM packages.",
"keywords": [
"strapi",
Expand Down
8 changes: 7 additions & 1 deletion src/node/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import pkgUp from 'pkg-up';
import type { Export } from './exports';
import type { Logger } from './logger';
import type { Runtime } from '../createBuildContext';
import type { PluginOption } from 'vite';
import type { InlineConfig, PluginOption } from 'vite';

interface LoadConfigOptions {
cwd: string;
Expand Down Expand Up @@ -107,6 +107,12 @@ interface ConfigOptions {
* @default tsconfig.build.json
*/
tsconfig?: string;

/**
* @experimental
* @description option to overwrite vite's config
*/
unstable_viteConfig?: InlineConfig;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/node/tasks/vite/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import react from '@vitejs/plugin-react-swc';
import { builtinModules } from 'node:module';
import path from 'path';
import { mergeConfig } from 'vite';

import { resolveConfigProperty } from '../../core/config';

Expand Down Expand Up @@ -133,7 +134,7 @@ const resolveViteConfig = async (ctx: BuildContext, task: ViteBaseTask) => {
plugins: [...basePlugins, ...plugins],
} satisfies InlineConfig;

return config;
return mergeConfig(config, ctx.config.unstable_viteConfig ?? {});
};

export { resolveViteConfig };

0 comments on commit 9dcd4a3

Please sign in to comment.