After updating TypeScript from version 3.9.6 to 4.4.4, our Storybook encountered multiple errors like the one shown below:
ERROR in ../pilot-mock-service/dist/mocks/image.js 3:7
Module parse failed: Unexpected token (3:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import { generateRandomInteger, generateRandomString, removeNullValues } from './mock.utils';
| export class ImagePilotData {
> alt;
| caption;
| credit;
@ ../pilot-mock-service/dist/mocks/index.js 61:0-41 61:0-41
@ ./stories/pages/qa/Post Page/postPagePrague.stories.tsx
@ ./stories sync \.stories\.tsx$
@ ./.storybook/preview.js
@ multi ../node_modules/@storybook/core/dist/server/common/polyfills.js ../node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/preview.js ../node_modules/webpack-hot-middleware/client.js?reload=true&quiet=true
Here are some key details about our project:
- Utilizing:
- yarn workspaces
- Storybook 5.3.19 (@storybook/addon-info @storybook/addon-knobs @storybook/addon-links @storybook/addon-viewport @storybook/addons @storybook/react)
- React 16.13
- Webpack 4
- Babel 7
- eslint 6
The dependencies in the troubled yarn workspace include:
{
"dependencies": {
"@babel/polyfill": "^7.10.1",
"aphrodite": "^2.2.3",
"axios": "^0.19.0",
"body-parser": "^1.18.3",
"consent-string": "^1.4.1",
"current-device": "^0.10.0",
"iframe-resizer": "^4.3.2",
"intersection-observer": "^0.7.0",
"luxon": "^1.22.0",
"mm-client-core": "1.0.0",
"mm-theme-configuration": "1.0.0",
"mm-ui-components": "1.0.0",
...
I've exhausted all possible solutions I could find without success. Any new suggestions would be highly valued.