bit
bit copied to clipboard
Module not found: Error: Can't resolve mdx file when ts config is set to use react-jsx
Describe the bug
A clear and concise description of the issue. I've configured a custom react env with tsconfig that uses jsx: "react-jsx" to enable the use of react 17 jsx transformation. However this throws the following error:
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.594 s, estimated 1 s
Ran all test suites.
✔ env "zenput-spike.bit-env-error/extensions/[email protected]", task "teambit.defender/tester:TestComponents" has completed successfully in 908ms
✔ env "teambit.envs/env", task "teambit.defender/tester:TestComponents" has completed successfully in 298μs
✔ env "zenput-spike.bit-env-error/extensions/[email protected]", task "teambit.pkg/pkg:PreparePackages" has completed successfully in 983μs
✔ env "zenput-spike.bit-env-error/extensions/[email protected]", task "teambit.harmony/application:build_application" has completed successfully in 278μs
✔ env "zenput-spike.bit-env-error/extensions/[email protected]", task "teambit.preview/preview:GenerateEnvTemplate" has completed successfully in 1ms
✖ env: zenput-spike.bit-env-error/extensions/[email protected], task "teambit.preview/preview:GeneratePreview" has failed
✔ env "teambit.envs/env", task "teambit.pkg/pkg:PreparePackages" has completed successfully in 2ms
✔ env "teambit.envs/env", task "teambit.harmony/application:build_application" has completed successfully in 36μs
⠄⠀ teambit.webpack/webpack, running Webpack bundler (1/1). process initiated by: GenerateEnvTemplate task. config created by env: teambit.envs/env. running on 1 components(node:28745) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/@teambit/react/node_modules/postcss/package.json.
Update this package.json to use a subpath pattern like "./*".
✔ env "teambit.envs/env", task "teambit.preview/preview:GenerateEnvTemplate" has completed successfully in 10s
⢀⠀ teambit.webpack/webpack, running Webpack bundler (1/1). process initiated by: GeneratePreview task. config created by env: teambit.envs/env. running on 0 component✔ env "teambit.envs/env", task "teambit.preview/preview:GeneratePreview" has completed successfully in 22ms
✔ executing post-build for all tasks
✖ teambit.pipelines/builder, running build pipe for 2 environments, total 15 tasks (completed in 14s)
The following errors were found while running the build pipeline
Failed task 1: "teambit.preview/preview:GeneratePreview" of env "zenput-spike.bit-env-error/extensions/[email protected]"
component: zenput-spike.bit-env-error/ui/[email protected]
ModuleNotFoundError: Module not found: Error: Can't resolve '/Users/halah/Library/Caches/Bit/capsules/f485181d1308a833ba45fd455b5c8f03ffad6c12/[email protected]/dist/my-welcome.docs.mdx' in '/Users/halah/Library/Caches/Bit/capsules/f485181d1308a833ba45fd455b5c8f03ffad6c12/[email protected]'
ModuleNotFoundError: Module not found: Error: Can't resolve '/Users/halah/Library/Caches/Bit/capsules/f485181d1308a833ba45fd455b5c8f03ffad6c12/[email protected]/dist/my-welcome.docs.mdx' in '/Users/halah/Library/Caches/Bit/capsules/f485181d1308a833ba45fd455b5c8f03ffad6c12/[email protected]'
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/lib/Compilation.js:1773:28
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/lib/NormalModuleFactory.js:811:13
at eval (eval at create (/Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/lib/NormalModuleFactory.js:286:22
at eval (eval at create (/Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/lib/NormalModuleFactory.js:442:22
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/lib/NormalModuleFactory.js:124:11
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/lib/NormalModuleFactory.js:673:25
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/lib/NormalModuleFactory.js:882:8
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/lib/NormalModuleFactory.js:1002:5
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/neo-async/async.js:6883:13
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/lib/NormalModuleFactory.js:985:45
at finishWithoutResolve (/Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:386:15
at /Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:435:5
at eval (eval at create (/Users/halah/.bvm/versions/0.0.790/bit-0.0.790/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
Found 1 errors in 1 components
✖ Total 15 tasks. 14 succeeded. 1 failed. 0 skipped. Total errors: 1.
Steps to Reproduce
use this repository to reproduce the issue https://github.com/HalahRaadSalih/bit-env-config-error
- git clone https://github.com/HalahRaadSalih/bit-env-config-error
- run
bit tag ui/my-welcome -m "remove theme code"
to repro on your own
- create custom react env
- enable tsconfig oveeride and in tsconfig file set
jsx: "react-jsx" - use the env with a component
- run bit cc & bit compile & bit link
- bit tag a component that uses the env and has an mdx file
Expected Behavior
A clear and concise description of what you expected to happen.
Screenshots, exceptions and logs
If applicable, add screenshots, exceptions, and logs to help explain your problem.
Specifications
- Bit version: 0.0.790
- Workspace type: (harmony/legacy) harmoney
- Node version: 16.4
- npm / yarn version: npm 8.3.1
- Platform: react
for harmony workspace
- relevant env
- relevant aspects
for leagacy
- Bit compiler (include version):
- Bit tester (include version):
Additional context
Add any other context about the problem here.