Open Mustafa-Aswadi opened 6 months ago
same for me
any solution yet?
tsconfig.json try adding the following config
"ts-node": {
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"moduleResolution": "nodenext"
}
}
then
const { createSVGWindow } = await import('svgdom')
tsconfig.json try adding the following config
"ts-node": { "compilerOptions": { "target": "es2015", "module": "commonjs", "moduleResolution": "nodenext" } }
then
const { createSVGWindow } = await import('svgdom')
hey @l86110 this solution works for me! thank you so much, module option ask me to be set as "nodenext" same as moduleResolution but its working
I used same solution, but i had other error
tsconfig.json try adding the following config
"ts-node": { "compilerOptions": { "target": "es2015", "module": "commonjs", "moduleResolution": "nodenext" } }
then
const { createSVGWindow } = await import('svgdom')
hey @l86110 this solution works for me! thank you so much, module option ask me to be set as "nodenext" same as moduleResolution but its working
new error
Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or nodenext', and the 'target' option is set to 'es2017' or higher.
some idea to solution
I want to use svgdom into nest js application and get the below error
Error [ERR_REQUIRE_ESM]: require() of ES Module ..\..\node_modules\svgdom\main-module.js from ..\..\..\main.js not supported. Instead change the require of main-module.js in .\..\..\dist\apps\services\-\main.js to a dynamic import() which is available in all CommonJS modules.
I tested both ways to import the package but did not work.