From e8ae7104deccfe6d34e6852ac7811aa802dba818 Mon Sep 17 00:00:00 2001 From: Yohan Kim Date: Fri, 17 Jun 2022 18:10:22 +0900 Subject: [PATCH 1/3] Support .cjs extension --- app/angular/src/server/framework-preset-angular-cli.test.ts | 2 +- app/react/src/server/framework-preset-react-docs.test.ts | 2 +- app/react/src/server/framework-preset-react-docs.ts | 2 +- lib/builder-webpack4/src/preview/babel-loader-preview.ts | 2 +- lib/builder-webpack4/src/preview/iframe-webpack.config.ts | 2 +- lib/builder-webpack5/src/preview/babel-loader-preview.ts | 2 +- lib/builder-webpack5/src/preview/iframe-webpack.config.ts | 2 +- lib/manager-webpack4/src/presets/babel-loader-manager.ts | 2 +- lib/manager-webpack4/src/presets/manager-preset.ts | 2 +- lib/manager-webpack5/src/presets/babel-loader-manager.ts | 2 +- lib/manager-webpack5/src/presets/manager-preset.ts | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/angular/src/server/framework-preset-angular-cli.test.ts b/app/angular/src/server/framework-preset-angular-cli.test.ts index b5e1b86eee2b..8dfbc75c02cc 100644 --- a/app/angular/src/server/framework-preset-angular-cli.test.ts +++ b/app/angular/src/server/framework-preset-angular-cli.test.ts @@ -793,7 +793,7 @@ const newWebpackConfiguration = ( rules: [{ keepBaseRule: true } as any], }, resolve: { - extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx', '.json', '.cjs'], + extensions: ['.cjs', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'], modules: ['node_modules'], mainFields: ['browser', 'main'], alias: { diff --git a/app/react/src/server/framework-preset-react-docs.test.ts b/app/react/src/server/framework-preset-react-docs.test.ts index bd86e13da568..7ed80a8cf5f0 100644 --- a/app/react/src/server/framework-preset-react-docs.test.ts +++ b/app/react/src/server/framework-preset-react-docs.test.ts @@ -32,7 +32,7 @@ describe('framework-preset-react-docgen', () => { presets: ['env', 'foo-preset'], overrides: [ { - test: /\.(mjs|tsx?|jsx?)$/, + test: /\.(cjs|mjs|tsx?|jsx?)$/, plugins: [ [ babelPluginReactDocgenPath, diff --git a/app/react/src/server/framework-preset-react-docs.ts b/app/react/src/server/framework-preset-react-docs.ts index 1e9a1e74cfb1..675d31487c75 100644 --- a/app/react/src/server/framework-preset-react-docs.ts +++ b/app/react/src/server/framework-preset-react-docs.ts @@ -21,7 +21,7 @@ export async function babel(config: TransformOptions, options: Options) { overrides: [ ...(config?.overrides || []), { - test: reactDocgen === 'react-docgen' ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/, + test: reactDocgen === 'react-docgen' ? /\.(cjs|mjs|tsx?|jsx?)$/ : /\.(cjs|mjs|jsx?)$/, plugins: [ [ require.resolve('babel-plugin-react-docgen'), diff --git a/lib/builder-webpack4/src/preview/babel-loader-preview.ts b/lib/builder-webpack4/src/preview/babel-loader-preview.ts index 7056e71e78d2..c7eee56fae41 100644 --- a/lib/builder-webpack4/src/preview/babel-loader-preview.ts +++ b/lib/builder-webpack4/src/preview/babel-loader-preview.ts @@ -2,7 +2,7 @@ import { getProjectRoot } from '@storybook/core-common'; import { useBaseTsSupport } from './useBaseTsSupport'; export const createBabelLoader = (options: any, framework: string) => ({ - test: useBaseTsSupport(framework) ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/, + test: useBaseTsSupport(framework) ? /\.(cjs|mjs|tsx?|jsx?)$/ : /\.(cjs|mjs|jsx?)$/, use: [ { loader: require.resolve('babel-loader'), diff --git a/lib/builder-webpack4/src/preview/iframe-webpack.config.ts b/lib/builder-webpack4/src/preview/iframe-webpack.config.ts index 66c2fbee4def..3c62280ea227 100644 --- a/lib/builder-webpack4/src/preview/iframe-webpack.config.ts +++ b/lib/builder-webpack4/src/preview/iframe-webpack.config.ts @@ -233,7 +233,7 @@ export default async (options: Options & Record): Promise { }; export const createBabelLoader = (options: any, framework: string) => ({ - test: useBaseTsSupport(framework) ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/, + test: useBaseTsSupport(framework) ? /\.(cjs|mjs|tsx?|jsx?)$/ : /\.(cjs|mjs|jsx?)$/, use: [ { loader: require.resolve('babel-loader'), diff --git a/lib/builder-webpack5/src/preview/iframe-webpack.config.ts b/lib/builder-webpack5/src/preview/iframe-webpack.config.ts index 7d2a18a7bf2e..a6b98075aed6 100644 --- a/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -234,7 +234,7 @@ export default async (options: Options & Record): Promise { const { plugins, presets } = getStorybookBabelConfig(); return { - test: /\.(mjs|tsx?|jsx?)$/, + test: /\.(cjs|mjs|tsx?|jsx?)$/, use: [ { loader: require.resolve('babel-loader'), diff --git a/lib/manager-webpack4/src/presets/manager-preset.ts b/lib/manager-webpack4/src/presets/manager-preset.ts index 69fd3620d3e6..b7b88d1bc922 100644 --- a/lib/manager-webpack4/src/presets/manager-preset.ts +++ b/lib/manager-webpack4/src/presets/manager-preset.ts @@ -156,7 +156,7 @@ export async function managerWebpack( ], }, resolve: { - extensions: ['.mjs', '.js', '.jsx', '.json', '.cjs', '.ts', '.tsx'], + extensions: ['.cjs', '.mjs', '.js', '.jsx', '.json', '.cjs', '.ts', '.tsx'], modules: ['node_modules'].concat(envs.NODE_PATH || []), mainFields: [modern ? 'sbmodern' : null, 'browser', 'module', 'main'].filter(Boolean), alias: { diff --git a/lib/manager-webpack5/src/presets/babel-loader-manager.ts b/lib/manager-webpack5/src/presets/babel-loader-manager.ts index 04ca8447de9d..72d68b591491 100644 --- a/lib/manager-webpack5/src/presets/babel-loader-manager.ts +++ b/lib/manager-webpack5/src/presets/babel-loader-manager.ts @@ -5,7 +5,7 @@ export const babelLoader = () => { const { plugins, presets } = getStorybookBabelConfig(); return { - test: /\.(mjs|tsx?|jsx?)$/, + test: /\.(cjs|mjs|tsx?|jsx?)$/, use: [ { loader: require.resolve('babel-loader'), diff --git a/lib/manager-webpack5/src/presets/manager-preset.ts b/lib/manager-webpack5/src/presets/manager-preset.ts index 1a332ea42a65..c43d73acb256 100644 --- a/lib/manager-webpack5/src/presets/manager-preset.ts +++ b/lib/manager-webpack5/src/presets/manager-preset.ts @@ -160,7 +160,7 @@ export async function managerWebpack( ], }, resolve: { - extensions: ['.mjs', '.js', '.jsx', '.json', '.cjs', '.ts', '.tsx'], + extensions: ['.cjs', '.mjs', '.js', '.jsx', '.json', '.cjs', '.ts', '.tsx'], modules: ['node_modules'].concat(envs.NODE_PATH || []), mainFields: [modern ? 'sbmodern' : null, 'browser', 'module', 'main'].filter(Boolean), alias: { From 2625f6a4a40fcdcd66f1f51c4a3cef929d570202 Mon Sep 17 00:00:00 2001 From: Yohan Kim Date: Wed, 29 Jun 2022 17:46:27 +0900 Subject: [PATCH 2/3] Fix order of extensions --- app/angular/src/server/framework-preset-angular-cli.test.ts | 2 +- lib/builder-webpack4/src/preview/iframe-webpack.config.ts | 2 +- lib/builder-webpack5/src/preview/iframe-webpack.config.ts | 2 +- lib/manager-webpack4/src/presets/manager-preset.ts | 2 +- lib/manager-webpack5/src/presets/manager-preset.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/angular/src/server/framework-preset-angular-cli.test.ts b/app/angular/src/server/framework-preset-angular-cli.test.ts index 8dfbc75c02cc..b5e1b86eee2b 100644 --- a/app/angular/src/server/framework-preset-angular-cli.test.ts +++ b/app/angular/src/server/framework-preset-angular-cli.test.ts @@ -793,7 +793,7 @@ const newWebpackConfiguration = ( rules: [{ keepBaseRule: true } as any], }, resolve: { - extensions: ['.cjs', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'], + extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx', '.json', '.cjs'], modules: ['node_modules'], mainFields: ['browser', 'main'], alias: { diff --git a/lib/builder-webpack4/src/preview/iframe-webpack.config.ts b/lib/builder-webpack4/src/preview/iframe-webpack.config.ts index 3c62280ea227..66c2fbee4def 100644 --- a/lib/builder-webpack4/src/preview/iframe-webpack.config.ts +++ b/lib/builder-webpack4/src/preview/iframe-webpack.config.ts @@ -233,7 +233,7 @@ export default async (options: Options & Record): Promise): Promise Date: Wed, 29 Jun 2022 17:54:05 +0900 Subject: [PATCH 3/3] Updatet snaphots --- .../cra-ts-essentials_manager-dev-posix | 2 +- .../cra-ts-essentials_manager-prod-posix | 259 +-------- .../cra-ts-essentials_preview-dev-posix | 4 +- .../cra-ts-essentials_preview-prod-posix | 501 +----------------- .../html-kitchen-sink_manager-dev-posix | 2 +- .../html-kitchen-sink_manager-prod-posix | 2 +- .../html-kitchen-sink_preview-dev-posix | 2 +- .../html-kitchen-sink_preview-prod-posix | 2 +- .../__snapshots__/vue-3-cli_manager-dev-posix | 2 +- .../vue-3-cli_manager-prod-posix | 2 +- .../__snapshots__/vue-3-cli_preview-dev-posix | 2 +- .../vue-3-cli_preview-prod-posix | 2 +- ...-components-kitchen-sink_manager-dev-posix | 2 +- ...components-kitchen-sink_manager-prod-posix | 2 +- ...-components-kitchen-sink_preview-dev-posix | 2 +- ...components-kitchen-sink_preview-prod-posix | 2 +- 16 files changed, 18 insertions(+), 772 deletions(-) diff --git a/lib/core-server/src/__snapshots__/cra-ts-essentials_manager-dev-posix b/lib/core-server/src/__snapshots__/cra-ts-essentials_manager-dev-posix index 1937cd52a90a..13c335a8dc80 100644 --- a/lib/core-server/src/__snapshots__/cra-ts-essentials_manager-dev-posix +++ b/lib/core-server/src/__snapshots__/cra-ts-essentials_manager-dev-posix @@ -40,7 +40,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/cra-ts-essentials_manager-prod-posix b/lib/core-server/src/__snapshots__/cra-ts-essentials_manager-prod-posix index 4bcbcf07d680..7e21d5625a97 100644 --- a/lib/core-server/src/__snapshots__/cra-ts-essentials_manager-prod-posix +++ b/lib/core-server/src/__snapshots__/cra-ts-essentials_manager-prod-posix @@ -1,262 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`cra-ts-essentials manager dev 1`] = ` -Object { - "entry": Array [ - "NODE_MODULES/@storybook/addon-ie11/dist/event-source-polyfill.js", - "ROOT/lib/core-client/dist/esm/globals/polyfills.js", - "ROOT/lib/core-client/dist/esm/manager/index.js", - "ROOT/addons/docs/manager.js", - "ROOT/addons/controls/manager.js", - "ROOT/addons/actions/manager.js", - "ROOT/addons/backgrounds/manager.js", - "ROOT/addons/toolbars/manager.js", - "ROOT/addons/measure/manager.js", - "ROOT/addons/outline/manager.js", - ], - "keys": Array [ - "name", - "mode", - "bail", - "devtool", - "entry", - "output", - "watchOptions", - "plugins", - "module", - "resolve", - "resolveLoader", - "recordsPath", - "performance", - "optimization", - ], - "module": Object { - "rules": Array [ - Object { - "exclude": Array [ - "NODE_MODULES/", - "/dist/", - ], - "include": Array [ - "ROOT", - ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/babel-loader/lib/index.js", - "options": Object { - "babelrc": false, - "configFile": false, - "plugins": Array [ - "NODE_MODULES/@babel/plugin-transform-shorthand-properties/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-block-scoping/lib/index.js", - Array [ - "NODE_MODULES/@babel/plugin-proposal-decorators/lib/index.js", - Object { - "legacy": true, - }, - ], - Array [ - "NODE_MODULES/@babel/plugin-proposal-class-properties/lib/index.js", - Object { - "loose": true, - }, - ], - Array [ - "NODE_MODULES/@babel/plugin-proposal-private-property-in-object/lib/index.js", - Object { - "loose": true, - }, - ], - Array [ - "NODE_MODULES/@babel/plugin-proposal-private-methods/lib/index.js", - Object { - "loose": true, - }, - ], - "NODE_MODULES/@babel/plugin-proposal-export-default-from/lib/index.js", - "NODE_MODULES/@babel/plugin-syntax-dynamic-import/lib/index.js", - Array [ - "NODE_MODULES/@babel/plugin-proposal-object-rest-spread/lib/index.js", - Object { - "loose": true, - "useBuiltIns": true, - }, - ], - "NODE_MODULES/@babel/plugin-transform-classes/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-arrow-functions/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-parameters/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-destructuring/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-spread/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-for-of/lib/index.js", - "NODE_MODULES/babel-plugin-macros/dist/index.js", - "NODE_MODULES/@babel/plugin-proposal-optional-chaining/lib/index.js", - "NODE_MODULES/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js", - Array [ - "NODE_MODULES/babel-plugin-polyfill-corejs3/lib/index.js", - Object { - "absoluteImports": "NODE_MODULES/core-js/index.js", - "method": "usage-global", - "version": "*", - }, - ], - "NODE_MODULES/@babel/plugin-transform-template-literals/lib/index.js", - ], - "presets": Array [ - Array [ - "NODE_MODULES/@babel/preset-env/lib/index.js", - Object { - "loose": true, - "shippedProposals": true, - }, - ], - "NODE_MODULES/@babel/preset-typescript/lib/index.js", - "NODE_MODULES/@babel/preset-react/lib/index.js", - ], - "sourceType": "unambiguous", - }, - }, - ], - }, - Object { - "include": [Function], - "test": "/\\\\.js$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/babel-loader/lib/index.js", - "options": Object { - "plugins": Array [ - "NODE_MODULES/@babel/plugin-transform-shorthand-properties/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-block-scoping/lib/index.js", - Array [ - "NODE_MODULES/@babel/plugin-proposal-decorators/lib/index.js", - Object { - "legacy": true, - }, - ], - Array [ - "NODE_MODULES/@babel/plugin-proposal-class-properties/lib/index.js", - Object { - "loose": true, - }, - ], - Array [ - "NODE_MODULES/@babel/plugin-proposal-private-property-in-object/lib/index.js", - Object { - "loose": true, - }, - ], - Array [ - "NODE_MODULES/@babel/plugin-proposal-private-methods/lib/index.js", - Object { - "loose": true, - }, - ], - "NODE_MODULES/@babel/plugin-proposal-export-default-from/lib/index.js", - "NODE_MODULES/@babel/plugin-syntax-dynamic-import/lib/index.js", - Array [ - "NODE_MODULES/@babel/plugin-proposal-object-rest-spread/lib/index.js", - Object { - "loose": true, - "useBuiltIns": true, - }, - ], - "NODE_MODULES/@babel/plugin-transform-classes/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-arrow-functions/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-parameters/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-destructuring/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-spread/lib/index.js", - "NODE_MODULES/@babel/plugin-transform-for-of/lib/index.js", - "NODE_MODULES/babel-plugin-macros/dist/index.js", - "NODE_MODULES/@babel/plugin-proposal-optional-chaining/lib/index.js", - "NODE_MODULES/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js", - Array [ - "NODE_MODULES/babel-plugin-polyfill-corejs3/lib/index.js", - Object { - "absoluteImports": "NODE_MODULES/core-js/index.js", - "method": "usage-global", - "version": "*", - }, - ], - ], - "presets": Array [ - Array [ - "NODE_MODULES/@babel/preset-env/lib/index.js", - Object { - "loose": true, - "modules": false, - "shippedProposals": true, - "targets": "defaults", - }, - ], - "NODE_MODULES/@babel/preset-react/lib/index.js", - ], - "sourceType": "unambiguous", - }, - }, - ], - }, - Object { - "test": "/\\\\.css$/", - "use": Array [ - "NODE_MODULES/style-loader/dist/cjs.js", - Object { - "loader": "NODE_MODULES/css-loader/dist/cjs.js", - "options": Object { - "importLoaders": 1, - }, - }, - ], - }, - Object { - "loader": "NODE_MODULES/file-loader/dist/cjs.js", - "options": Object { - "name": "static/media/[path][name].[ext]", - }, - "test": "/\\\\.(svg|ico|jpg|jpeg|png|apng|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)(\\\\?.*)?$/", - }, - Object { - "loader": "NODE_MODULES/url-loader/dist/cjs.js", - "options": Object { - "limit": 10000, - "name": "static/media/[path][name].[ext]", - }, - "test": "/\\\\.(mp4|webm|wav|mp3|m4a|aac|oga)(\\\\?.*)?$/", - }, - Object { - "include": "NODE_MODULES[\\\\\\\\/](@storybook[\\\\\\\\/]node_logger|@testing-library[\\\\\\\\/]dom|@testing-library[\\\\\\\\/]user-event|acorn-jsx|ansi-align|ansi-colors|ansi-escapes|ansi-regex|ansi-styles|better-opn|boxen|camelcase|chalk|color-convert|commander|find-cache-dir|find-up|fs-extra|highlight.js|json5|node-fetch|pkg-dir|prettier|pretty-format|react-dev-utils|resolve-from|semver|slash|strip-ansi|uuid)/", - "test": "/\\\\.js$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/babel-loader/lib/index.js", - "options": Object { - "presets": Array [ - Array [ - "@babel/preset-env", - Object { - "targets": Object { - "ie": "11", - }, - }, - "storybook-addon-ie11", - ], - ], - "sourceType": "unambiguous", - }, - }, - ], - }, - ], - }, - "plugins": Array [ - "VirtualModulesPlugin", - "HtmlWebpackPlugin", - "CaseSensitivePathsPlugin", - "DefinePlugin", - ], -} -`; - exports[`cra-ts-essentials manager prod 1`] = ` Object { "entry": Array [ @@ -297,7 +40,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-dev-posix b/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-dev-posix index 45f3199dcaa1..74d84b599459 100644 --- a/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-dev-posix +++ b/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-dev-posix @@ -360,7 +360,7 @@ Object { }, ], ], - "test": "/\\\\.(mjs|jsx?)$/", + "test": "/\\\\.(cjs|mjs|jsx?)$/", }, ], "plugins": Array [ @@ -410,7 +410,7 @@ Object { }, ], ], - "test": "/\\\\.(mjs|jsx?)$/", + "test": "/\\\\.(cjs|mjs|jsx?)$/", }, ], "plugins": Array [ diff --git a/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-prod-posix b/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-prod-posix index 19d3bb4c27a5..6e7e1b6c8ea4 100644 --- a/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-prod-posix +++ b/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-prod-posix @@ -1,502 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`cra-ts-essentials preview dev 1`] = ` -Object { - "entry": Array [ - "ROOT/lib/core-client/dist/esm/globals/polyfills.js", - "ROOT/lib/core-client/dist/esm/globals/globals.js", - "NODE_MODULES/@storybook/addon-ie11/dist/event-source-polyfill.js", - "ROOT/storybook-init-framework-entry.js", - "ROOT/app/react/dist/esm/client/docs/config-generated-config-entry.js", - "ROOT/app/react/dist/esm/client/preview/config-generated-config-entry.js", - "ROOT/addons/docs/preview.js-generated-config-entry.js", - "ROOT/addons/actions/preview.js-generated-config-entry.js", - "ROOT/addons/backgrounds/preview.js-generated-config-entry.js", - "ROOT/addons/measure/preview.js-generated-config-entry.js", - "ROOT/addons/outline/preview.js-generated-config-entry.js", - "ROOT/examples/cra-ts-essentials/.storybook/preview.tsx-generated-config-entry.js", - "ROOT/generated-stories-entry.js", - ], - "keys": Array [ - "name", - "mode", - "bail", - "devtool", - "entry", - "output", - "watchOptions", - "plugins", - "module", - "resolve", - "resolveLoader", - "optimization", - "performance", - ], - "module": Object { - "rules": Array [ - Object { - "test": "/\\\\.md$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/raw-loader/dist/cjs.js", - }, - ], - }, - Object { - "parser": Object { - "requireEnsure": false, - }, - }, - Object { - "oneOf": Array [ - Object { - "loader": "NODE_MODULES/url-loader/dist/cjs.js", - "options": Object { - "limit": 10000, - "mimetype": "image/avif", - "name": "static/media/[name].[hash:8].[ext]", - }, - "test": Array [ - "/\\\\.avif$/", - ], - }, - Object { - "loader": "NODE_MODULES/url-loader/dist/cjs.js", - "options": Object { - "limit": 10000, - "name": "static/media/[name].[hash:8].[ext]", - }, - "test": Array [ - "/\\\\.bmp$/", - "/\\\\.gif$/", - "/\\\\.jpe?g$/", - "/\\\\.png$/", - ], - }, - Object { - "include": Array [ - "ROOT/src", - "ROOT/examples/cra-ts-essentials/.storybook", - ], - "loader": "NODE_MODULES/babel-loader/lib/index.js", - "options": Object { - "babelrc": false, - "cacheCompression": false, - "cacheDirectory": true, - "cacheIdentifier": "production:babel-plugin-named-asset-import@:babel-preset-react-app@10.0.1:react-dev-utils@11.0.4:react-scripts@4.0.3", - "compact": true, - "configFile": false, - "customize": "NODE_MODULES/babel-preset-react-app/webpack-overrides.js", - "extends": undefined, - "overrides": Array [ - Object { - "plugins": Array [ - Array [ - "NODE_MODULES/babel-plugin-react-docgen/lib/index.js", - Object { - "DOC_GEN_COLLECTION_NAME": "STORYBOOK_REACT_CLASSES", - }, - ], - ], - "test": "/\\\\.(mjs|jsx?)$/", - }, - ], - "plugins": Array [ - Array [ - "NODE_MODULES/babel-plugin-named-asset-import/index.js", - Object { - "loaderMap": Object { - "svg": Object { - "ReactComponent": "@svgr/webpack?-svgo,+titleProp,+ref![path]", - }, - }, - }, - ], - ], - "presets": Array [ - Array [ - "@babel/preset-env", - Object { - "targets": Object { - "ie": "11", - }, - }, - "storybook-addon-ie11", - ], - Array [ - "NODE_MODULES/babel-preset-react-app/index.js", - Object { - "runtime": "automatic", - }, - ], - ], - }, - "test": "/\\\\.(js|mjs|jsx|ts|tsx)$/", - }, - Object { - "exclude": "/@babel(?:\\\\/|\\\\\\\\{1,2})runtime/", - "include": Array [ - "ROOT/examples/cra-ts-essentials/.storybook", - ], - "loader": "NODE_MODULES/babel-loader/lib/index.js", - "options": Object { - "babelrc": false, - "cacheCompression": false, - "cacheDirectory": true, - "cacheIdentifier": "production:babel-plugin-named-asset-import@:babel-preset-react-app@10.0.1:react-dev-utils@11.0.4:react-scripts@4.0.3", - "compact": false, - "configFile": false, - "inputSourceMap": true, - "presets": Array [ - Array [ - "NODE_MODULES/babel-preset-react-app/dependencies.js", - Object { - "helpers": true, - }, - ], - ], - "sourceMaps": true, - }, - "test": "/\\\\.(js|mjs)$/", - }, - Object { - "exclude": Array [ - "/\\\\.module\\\\.css$/", - "/@storybook/", - ], - "include": undefined, - "sideEffects": true, - "test": "/\\\\.css$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/mini-css-extract-plugin/dist/loader.js", - "options": Object { - "publicPath": "../../", - }, - }, - Object { - "loader": "NODE_MODULES/css-loader/dist/cjs.js", - "options": Object { - "importLoaders": 1, - "sourceMap": true, - }, - }, - Object { - "loader": "NODE_MODULES/postcss-loader/src/index.js", - "options": Object { - "ident": "postcss", - "plugins": [Function], - "sourceMap": true, - }, - }, - ], - }, - Object { - "test": "/\\\\.module\\\\.css$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/mini-css-extract-plugin/dist/loader.js", - "options": Object { - "publicPath": "../../", - }, - }, - Object { - "loader": "NODE_MODULES/css-loader/dist/cjs.js", - "options": Object { - "importLoaders": 1, - "modules": Object { - "getLocalIdent": [Function], - }, - "sourceMap": true, - }, - }, - Object { - "loader": "NODE_MODULES/postcss-loader/src/index.js", - "options": Object { - "ident": "postcss", - "plugins": [Function], - "sourceMap": true, - }, - }, - ], - }, - Object { - "exclude": "/\\\\.module\\\\.(scss|sass)$/", - "sideEffects": true, - "test": "/\\\\.(scss|sass)$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/mini-css-extract-plugin/dist/loader.js", - "options": Object { - "publicPath": "../../", - }, - }, - Object { - "loader": "NODE_MODULES/css-loader/dist/cjs.js", - "options": Object { - "importLoaders": 3, - "sourceMap": true, - }, - }, - Object { - "loader": "NODE_MODULES/postcss-loader/src/index.js", - "options": Object { - "ident": "postcss", - "plugins": [Function], - "sourceMap": true, - }, - }, - Object { - "loader": "NODE_MODULES/resolve-url-loader/index.js", - "options": Object { - "root": "ROOT/src", - "sourceMap": true, - }, - }, - Object { - "loader": "NODE_MODULES/sass-loader/dist/cjs.js", - "options": Object { - "sourceMap": true, - }, - }, - ], - }, - Object { - "test": "/\\\\.module\\\\.(scss|sass)$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/mini-css-extract-plugin/dist/loader.js", - "options": Object { - "publicPath": "../../", - }, - }, - Object { - "loader": "NODE_MODULES/css-loader/dist/cjs.js", - "options": Object { - "importLoaders": 3, - "modules": Object { - "getLocalIdent": [Function], - }, - "sourceMap": true, - }, - }, - Object { - "loader": "NODE_MODULES/postcss-loader/src/index.js", - "options": Object { - "ident": "postcss", - "plugins": [Function], - "sourceMap": true, - }, - }, - Object { - "loader": "NODE_MODULES/resolve-url-loader/index.js", - "options": Object { - "root": "ROOT/src", - "sourceMap": true, - }, - }, - Object { - "loader": "NODE_MODULES/sass-loader/dist/cjs.js", - "options": Object { - "sourceMap": true, - }, - }, - ], - }, - Object { - "exclude": Array [ - "/\\\\.(js|mjs|jsx|ts|tsx)$/", - "/\\\\.html$/", - "/\\\\.json$/", - "/\\\\.(ejs|md|mdx)$/", - ], - "loader": "NODE_MODULES/file-loader/dist/cjs.js", - "options": Object { - "name": "static/media/[name].[hash:8].[ext]", - }, - }, - ], - }, - Object { - "include": "NODE_MODULES[\\\\\\\\/](@storybook[\\\\\\\\/]node_logger|@testing-library[\\\\\\\\/]dom|@testing-library[\\\\\\\\/]user-event|acorn-jsx|ansi-align|ansi-colors|ansi-escapes|ansi-regex|ansi-styles|better-opn|boxen|camelcase|chalk|color-convert|commander|find-cache-dir|find-up|fs-extra|highlight.js|json5|node-fetch|pkg-dir|prettier|pretty-format|react-dev-utils|resolve-from|semver|slash|strip-ansi|uuid)/", - "test": "/\\\\.js$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/babel-loader/lib/index.js", - "options": Object { - "presets": Array [ - Array [ - "@babel/preset-env", - Object { - "targets": Object { - "ie": "11", - }, - }, - "storybook-addon-ie11", - ], - ], - "sourceType": "unambiguous", - }, - }, - ], - }, - Object { - "include": "NODE_MODULES\\\\/acorn-jsx/", - "test": "/\\\\.js$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/babel-loader/lib/index.js", - "options": Object { - "presets": Array [ - Array [ - "NODE_MODULES/@babel/preset-env/lib/index.js", - Object { - "modules": "commonjs", - }, - ], - ], - }, - }, - ], - }, - Object { - "test": "/(stories|story)\\\\.mdx$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/babel-loader/lib/index.js", - "options": Object { - "babelrc": false, - "cacheDirectory": "NODE_MODULES/.cache/storybook/babel", - "configFile": false, - "overrides": Array [ - Object { - "plugins": Array [ - Array [ - "NODE_MODULES/babel-plugin-react-docgen/lib/index.js", - Object { - "DOC_GEN_COLLECTION_NAME": "STORYBOOK_REACT_CLASSES", - }, - ], - ], - "test": "/\\\\.(mjs|jsx?)$/", - }, - ], - "plugins": Array [ - Array [ - "NODE_MODULES/@babel/plugin-transform-react-jsx/lib/index.js", - Object { - "pragma": "React.createElement", - "pragmaFrag": "React.Fragment", - }, - ], - ], - "presets": Array [ - Array [ - "@babel/preset-env", - Object { - "targets": Object { - "ie": "11", - }, - }, - "storybook-addon-ie11", - ], - ], - }, - }, - Object { - "loader": "NODE_MODULES/@storybook/mdx1-csf/loader.js", - }, - ], - }, - Object { - "exclude": "/(stories|story)\\\\.mdx$/", - "test": "/\\\\.mdx$/", - "use": Array [ - Object { - "loader": "NODE_MODULES/babel-loader/lib/index.js", - "options": Object { - "babelrc": false, - "cacheDirectory": "NODE_MODULES/.cache/storybook/babel", - "configFile": false, - "overrides": Array [ - Object { - "plugins": Array [ - Array [ - "NODE_MODULES/babel-plugin-react-docgen/lib/index.js", - Object { - "DOC_GEN_COLLECTION_NAME": "STORYBOOK_REACT_CLASSES", - }, - ], - ], - "test": "/\\\\.(mjs|jsx?)$/", - }, - ], - "plugins": Array [ - Array [ - "NODE_MODULES/@babel/plugin-transform-react-jsx/lib/index.js", - Object { - "pragma": "React.createElement", - "pragmaFrag": "React.Fragment", - }, - ], - ], - "presets": Array [ - Array [ - "@babel/preset-env", - Object { - "targets": Object { - "ie": "11", - }, - }, - "storybook-addon-ie11", - ], - ], - }, - }, - Object { - "loader": "NODE_MODULES/@storybook/mdx1-csf/loader.js", - "options": Object { - "remarkPlugins": Array [ - [Function], - [Function], - ], - "skipCsf": true, - }, - }, - ], - }, - Object { - "enforce": "pre", - "loader": "ROOT/lib/source-loader/dist/cjs/index.js", - "options": Object { - "injectStoryParameters": true, - "inspectLocalDependencies": true, - }, - "test": "/\\\\.(stories|story)\\\\.[tj]sx?$/", - }, - ], - }, - "plugins": Array [ - "FilterWarningsPlugin", - "VirtualModulesPlugin", - "HtmlWebpackPlugin", - "DefinePlugin", - "CaseSensitivePathsPlugin", - "ProgressPlugin", - "InlineChunkHtmlPlugin", - "InterpolateHtmlPlugin", - "ModuleNotFoundPlugin", - "MiniCssExtractPlugin", - "ManifestPlugin", - "IgnorePlugin", - "ForkTsCheckerWebpackPlugin", - "ESLintWebpackPlugin", - "IgnorePlugin", - "DocgenPlugin", - ], -} -`; - exports[`cra-ts-essentials preview prod 1`] = ` Object { "entry": Array [ @@ -875,7 +378,7 @@ Object { }, ], ], - "test": "/\\\\.(mjs|jsx?)$/", + "test": "/\\\\.(cjs|mjs|jsx?)$/", }, ], "plugins": Array [ @@ -925,7 +428,7 @@ Object { }, ], ], - "test": "/\\\\.(mjs|jsx?)$/", + "test": "/\\\\.(cjs|mjs|jsx?)$/", }, ], "plugins": Array [ diff --git a/lib/core-server/src/__snapshots__/html-kitchen-sink_manager-dev-posix b/lib/core-server/src/__snapshots__/html-kitchen-sink_manager-dev-posix index 9fcbeaa6c249..e73793bb5a10 100644 --- a/lib/core-server/src/__snapshots__/html-kitchen-sink_manager-dev-posix +++ b/lib/core-server/src/__snapshots__/html-kitchen-sink_manager-dev-posix @@ -41,7 +41,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/html-kitchen-sink_manager-prod-posix b/lib/core-server/src/__snapshots__/html-kitchen-sink_manager-prod-posix index 348d29de932a..88df4ac7b910 100644 --- a/lib/core-server/src/__snapshots__/html-kitchen-sink_manager-prod-posix +++ b/lib/core-server/src/__snapshots__/html-kitchen-sink_manager-prod-posix @@ -41,7 +41,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-dev-posix b/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-dev-posix index fef4e5b1e09b..f05e53f9bf47 100644 --- a/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-dev-posix +++ b/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-dev-posix @@ -39,7 +39,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-prod-posix b/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-prod-posix index d1c67aacb001..840cbdd0dc60 100644 --- a/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-prod-posix +++ b/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-prod-posix @@ -38,7 +38,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/vue-3-cli_manager-dev-posix b/lib/core-server/src/__snapshots__/vue-3-cli_manager-dev-posix index ec8992f03346..01c529220ab8 100644 --- a/lib/core-server/src/__snapshots__/vue-3-cli_manager-dev-posix +++ b/lib/core-server/src/__snapshots__/vue-3-cli_manager-dev-posix @@ -42,7 +42,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/vue-3-cli_manager-prod-posix b/lib/core-server/src/__snapshots__/vue-3-cli_manager-prod-posix index a686af760a22..a86a667481da 100644 --- a/lib/core-server/src/__snapshots__/vue-3-cli_manager-prod-posix +++ b/lib/core-server/src/__snapshots__/vue-3-cli_manager-prod-posix @@ -42,7 +42,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix b/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix index ab76b4d0c1c7..4cf2f80e4570 100644 --- a/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix +++ b/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix @@ -41,7 +41,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix b/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix index c769b18749c7..fe831e185d10 100644 --- a/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix +++ b/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix @@ -40,7 +40,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-dev-posix b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-dev-posix index 0676e83166fe..f3dec4361294 100644 --- a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-dev-posix +++ b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-dev-posix @@ -42,7 +42,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-prod-posix b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-prod-posix index 982723cbc1ac..be24c3d5e9fc 100644 --- a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-prod-posix +++ b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-prod-posix @@ -42,7 +42,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix index 12efbe2571e2..5ef8867718bb 100644 --- a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix +++ b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix @@ -40,7 +40,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js", diff --git a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix index 0a9453609940..51adf69ea33c 100644 --- a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix +++ b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix @@ -39,7 +39,7 @@ Object { "include": Array [ "ROOT", ], - "test": "/\\\\.(mjs|tsx?|jsx?)$/", + "test": "/\\\\.(cjs|mjs|tsx?|jsx?)$/", "use": Array [ Object { "loader": "NODE_MODULES/babel-loader/lib/index.js",