Closed IgorBabkin closed 4 years ago
In what context are you using it (e.g., node, browser, etc)? And are you using commonjs or esm?
I ask because the main
build uses commonjs, which does not have a .default
property in the same way that the module
build does because that uses esm.
I'd just like to chime in to say that I'm having the same issue. And my ts config contains: "module": "commonjs",
I am using it in a nodejs context. Let me know if you need any other details
Can you try specifying the full path to the module, e.g. import copy from 'fast-copy/dist/fast-copy.esm.js';
? That should provide a work around.
Thanks. It seems to get further but then there is some kind of syntax error with the export:
\node_modules\fast-copy\dist\fast-copy.esm.js:309
export default copy;
^^^^^^
SyntaxError: Unexpected token export
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
Well I just realized ... Are you using import
syntax when you are setting module: commonjs
in your config. Why aren't you using es2015
or esnext
? Because that would could cause the error you're seeing.
Closing due to inactivity.
I add fast-copy to my TS project and got this error.
DesignElement.ts:125 Uncaught (in promise) TypeError: fast_copy_1.default is not a function
. I've analyzed .js file and didn't find default import. But in declaration file it declares as default.