Skip to content

Commit

Permalink
Merge pull request #19852 from storybookjs/fix/server-require-double-…
Browse files Browse the repository at this point in the history
…esbuildregister

fix double esbuild-register register
  • Loading branch information
ndelangen authored Nov 17, 2022
2 parents 4bf9d31 + 54ab89c commit 0c36f0a
Show file tree
Hide file tree
Showing 4 changed files with 438 additions and 413 deletions.
1 change: 0 additions & 1 deletion code/addons/links/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const hrefTo = (title: ComponentTitle, name: StoryName): Promise<string>
});
};

// eslint-disable-next-line @typescript-eslint/no-shadow
const valueOrCall = (args: string[]) => (value: string | ((...args: string[]) => string)) =>
typeof value === 'function' ? value(...args) : value;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-shadow */
import webpack from 'webpack';
import { logger } from '@storybook/node-logger';
import { BuilderContext, Target, targetFromTargetString } from '@angular-devkit/architect';
Expand Down
5 changes: 4 additions & 1 deletion code/lib/core-common/src/utils/interpret-require.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { getInterpretedFileWithExt } from './interpret-files';
let registered = false;

export function interopRequireDefault(filePath: string) {
if (registered === false) {
// eslint-disable-next-line no-underscore-dangle, global-require
const hasEsbuildBeenRegistered = !!require('module')._extensions['.ts'];

if (registered === false && !hasEsbuildBeenRegistered) {
// eslint-disable-next-line global-require
const { register } = require('esbuild-register/dist/node');
registered = true;
Expand Down
Loading

0 comments on commit 0c36f0a

Please sign in to comment.