Skip to content

Commit

Permalink
Webpack5: Apply named exports order logic for stories only
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed May 20, 2022
1 parent 3f0566b commit 89dc4f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/react/src/server/framework-preset-react-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export async function babel(config: TransformOptions, options: Options) {
return {
...config,
overrides: [
...(config?.overrides || []),
{
test: reactDocgen === 'react-docgen' ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/,
plugins: [
Expand Down
15 changes: 10 additions & 5 deletions lib/builder-webpack5/src/presets/preview-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ export const entries = async (_: unknown, options: any) => {
return result;
};

export const babel = async (config: any, options: any) => {
// FIXME: Add this to overrides to only apply to story files
config.plugins.push('babel-plugin-named-exports-order');
return config;
};
export const babel = async (config: any, options: any) => ({
...config,
overrides: [
...(config?.overrides || []),
{
test: /\.(story|stories).*$/,
plugins: [require.resolve('babel-plugin-named-exports-order')],
},
],
});

0 comments on commit 89dc4f1

Please sign in to comment.