Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using es import from workspace packages #20292

Closed
vks-dbb opened this issue May 9, 2024 · 1 comment
Closed

Using es import from workspace packages #20292

vks-dbb opened this issue May 9, 2024 · 1 comment
Labels
flag: invalid template Automation Flag to handle invalid bug report templates

Comments

@vks-dbb
Copy link

vks-dbb commented May 9, 2024

I encountered the problem of not being able to import files from workspace packages (monorepo), in my case it was the @some/common package, complaining that this is not supported in the ts file.

strapi:build: cache bypass, force executing 9df377beb679af49
strapi:build: [WARN] [@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior.
strapi:build: ⠋ Compiling TS src/api/healthcheck/controllers/healthcheck.ts:4:38 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@some/common")' call instead.
@dbbs/strapi:build: To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field "type": "module" to '/apps/strapi/package.json'.
strapi:build:
strapi:build: import { SettingServiceClient } from '@some/common'

my tsconfig configuration:

{
   "extends": [
     "@strapi/typescript-utils/tsconfigs/server"
   ],
   "compilerOptions": {
     "rootDir": ".",
     "module": "NodeNext",
     "target": "ESNext",
     "moduleResolution": "NodeNext",
     "outDir": "dist",
     "noImplicitAny": false,
     "allowJs": true,
     "composite": false,
     "declaration": false
   },
   "include": [
     "./",
     "./**/*.ts",
     "./**/*.mts",
     "./**/*.js",
     "src/**/*.json"
   ],
   "exclude": [
     "node_modules/",
     "build/",
     "dist/",
     ".cache/",
     ".tmp/",
     "src/admin/",
     "**/*.test.*",
     "src/plugins/**"
   ]
}
@joshuaellis joshuaellis added the flag: invalid template Automation Flag to handle invalid bug report templates label May 9, 2024
Copy link
Contributor

github-actions bot commented May 9, 2024

This is a templated message

Hello @vks-dbb,

We ask that you please follow the issue template.
A proper issue submission let's us better understand the origin of your bug and therefore help you. We will reopen your issue when we receive the issue following the template guidelines and properly fill out the template. You can see the template guidelines for bug reports here.

Please update the issue with the template and we can reopen this report.

Thank you.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: invalid template Automation Flag to handle invalid bug report templates
Projects
Status: Done
Development

No branches or pull requests

2 participants