You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From trying things myself, it looks like this issue is more "preconstruct dev doesn't work with create-react-app". I'm guessing you'll need to use one of the forks of react-scripts and make it compile files outside of the create-react-app project as well as what it already does compile (though only outside the directory and not in node_modules).
@mitchellhamilton Thank you for your answer~
I find out that the problem was caused because of non-ts create-react-app cannot compile a ts file from dependency.
In dev mode, the dist file xxx.esm.js is basically a symlink to source file, so that non-ts CRA compiler can't work on that.
My temp solution (turn on ts for CRA):
Add @craco/craco and ts-loader and typescript
Config ts-loader as a webpack loader
Add a tsconfig.json at root
But that's not perfect, I have an idea, use a hook loader or something to pre compile the symlink dist file, like what did on cjs file, is that possible?
shared
is a dependency ofcreate-react-app
shared/src/index.ts
create-react-app/src/index.jsx
preconstruct dev
mode creates symlink for module so that if dependent cannot resolve ts file then error causes.The text was updated successfully, but these errors were encountered: