Runtime error on module.exports
JonSilver opened this issue · 2 comments
TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
This error occurs in node_modules/@simbathesailor/use-what-changed/dist/use-what-changed.esm.js:119
which is a product of the Typescript transpilation process.
The errant line is module.exports = useWhatChanged;
which cannot be used with import
.
The original line of code is export { useWhatChanged };
I think something's gone wrong with the transpilation process. Wrong target?
Ahh I think We cant mix import and module.exports. webpack/webpack#4039 (comment)
I have published a new version of this package. Now import changes to :
import useWhatChanged from "@simbathesailor/use-what-changed"
import { useWhatChanged } from "@simbathesailor/use-what-changed"
Yup, that works :)