Description
Related to #707. There are still some warnings with version 4.7.0-rc5. Good news is that my solution now works (where it didn't with the latest stable release). So maybe we just need whatever @Andarist did, but a bit more of it :).
Expected Result
No warnings or errors while bundling. The final bundle should work
Actual Result
I see the following warnings but it doesn't seem to cause issues with final solution
Warning - [webpack] 'dist':
./node_modules/.pnpm/registry.npmjs.org/@xstate/react/0.7.[email protected][email protected]/node_modules/@xstate/react/lib/index.js
Module Warning (from ./node_modules/.pnpm/registry.npmjs.org/source-map-loader/0.2.4/node_modules/source-map-loader/index.js):
(Emitted value instead of an instance of Error) Cannot find source file '../src/index.ts': Error: Can't resolve '../src/index.ts' in 'xxx\node_modules.pnpm\registry.npmjs.org@xstate\react\0.7.[email protected][email protected]\node_modulesmd5-4206ca73d2252f9eeb768287b5b1031dxstate\reactlib'
NonErrorEmittedError: (Emitted value instead of an instance of Error) Cannot find source file '../src/index.ts': Error: Can't resolve '../src/index.ts' in 'xxx\node_modules.pnpm\registry.npmjs.org@xstate\react\0.7.[email protected][email protected]\node_modulesmd5-4206ca73d2252f9eeb768287b5b1031dxstate\reactlib'
at emitWarning (xxx\node_modules.pnpm\registry.npmjs.org\webpack\[email protected]\node_modules\webpacklib\NormalModule.js:154:16)
at xxx\node_modules.pnpm\registry.npmjs.org\source-map-loader\0.2.4\node_modules\source-map-loader\index.js:80:7
at doResolve (xxx\node_modules.pnpm\registry.npmjs.org\enhanced-resolve\4.1.1\node_modules\enhanced-resolvelib\Resolver.js:213:14)
at hook.callAsync (xxx\node_modules.pnpm\registry.npmjs.org\enhanced-resolve\4.1.1\node_modules\enhanced-resolvelib\Resolver.js:285:5)
at _fn0 (eval at create (xxx\node_modules.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapablelib\HookCodeFactory.js:33:10),:15:1)
at resolver.doResolve (xxx\node_modules.pnpm\registry.npmjs.org\enhanced-resolve\4.1.1\node_modules\enhanced-resolvelib\UnsafeCachePlugin.js:44:7)
at hook.callAsync (xxx\node_modules.pnpm\registry.npmjs.org\enhanced-resolve\4.1.1\node_modules\enhanced-resolvelib\Resolver.js:285:5)
at _fn0 (eval at create (xxx\node_modules.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapablelib\HookCodeFactory.js:33:10),:15:1)
at hook.callAsync (xxx\node_modules.pnpm\registry.npmjs.org\enhanced-resolve\4.1.1\node_modules\enhanced-resolvelib\Resolver.js:285:5)
at _fn0 (eval at create (xxx\node_modules.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapablelib\HookCodeFactory.js:33:10),:27:1)
at resolver.doResolve (xxx\node_modules.pnpm\registry.npmjs.org\enhanced-resolve\4.1.1\node_modules\enhanced-resolvelib\DescriptionFilePlugin.js:67:43)
at hook.callAsync (xxx\node_modules.pnpm\registry.npmjs.org\enhanced-resolve\4.1.1\node_modules\enhanced-resolvelib\Resolver.js:285:5)
at _fn42 (eval at create (xxx\node_modules.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapablelib\HookCodeFactory.js:33:10),:16:1)
at hook.callAsync (xxx\node_modules.pnpm\registry.npmjs.org\enhanced-resolve\4.1.1\node_modules\enhanced-resolvelib\Resolver.js:285:5)
at _fn0 (eval at create (xxx\node_modules.pnpm\registry.npmjs.org\tapable\1.1.3\node_modules\tapablelib\HookCodeFactory.js:33:10),:27:1)
at resolver.doResolve (xxx\node_modules.pnpm\registry.npmjs.org\enhanced-resolve\4.1.1\node_modules\enhanced-resolvelib\DescriptionFilePlugin.js:67:43)
@
Reproduction
Typescript project with xstate
Additional context
possibly related to #707
xstate4.7.0-rc5
@xstate/react 0.7.1
TypeScript 2.9
Could u prepare a runnable repro case? Would make it a lot easier for me to just fix it without wild-guessing how it behaves on your machine, for things like this the exact setup often really matters.
Could u prepare a runnable repro case? Would make it a lot easier for me to just fix it without wild-guessing how it behaves on your machine, for things like this the exact setup often really matters.
Tried replicating in a create react app but couldn't. I'm using a framework which is not exactly well known but I'll prepare an example and prepare some basic instructions to demo the issue. I'll try to do that tonight but might have to do it over the weekend.
I'm having this same issue when enabling angular vendor sourcemaps in the angular.json serve config. I have a public repo available to reproduce this issue here: https://github.com/jhallick/xstate-angular-sourcemap-test
Notice in the angular.json serve config I have:
sourceMap: {
scripts: true,
styles: true,
vendor: true
}
which breaks xstate at runtime (and throws a bunch of warnings as stated above). NOTE: this replaces the deprecated vendorSourceMap: true serve config option, which also broke xstate at runtime.
Please let me know if more details are needed!
@Andarist Runnable angular repro case above鈽濓笍
This demo is using [email protected] - the fix for this problem is available already in the [email protected]
@Andarist Okay awesome, ty! I'll give that version a try today and post back.
@Andarist Worked like a charm, thank you! :tada:
@Andarist Is there a change in that version that I missed? My public repo posted above is now getting this error at compile time (after upgrading to xstate 4.7.0-rc5):
ERROR in node_modules/xstate/lib/State.d.ts(86,42): error TS2344: Type 'TStateSchema' does not satisfy the constraint 'StateSchema<TState["context"]>'.
Type 'StateSchema<TContext>' is not assignable to type 'StateSchema<TState["context"]>'.
Type 'TContext' is not assignable to type 'TState["context"]'.
I'm having trouble figuring it out...any help would be greatly appreciated.
@jhallick could you report this as a separate issue? with repro and TS version associated?
@Andarist Absolutely will do, thanks again!
@Andarist Upgrading our TS version ended up fixing it, thanks again for the help!