Isomorphic supported ?
See original GitHub issueHi, Really love what you done here that why I would like to use it both client and server in isomorphic way
Anyway there are some issues warning report from Webpack bundle cause by importing module
WARNING in ./~/typedjson/js/index.js Critical dependencies: 25:24-31 require function is used in a way in which dependencies cannot be statically extracted @ ./~/typedjson/js/index.js 25:24-31
WARNING in ./~/typedjson/js/index.d.ts Module parse failed: C:\Users\U6038377\Documents\ReadAround.me-Isomorphic\node_modules\typedjson\js\index.d.ts The keywo rd ‘interface’ is reserved (23:0) You may need an appropriate loader to handle this file type. SyntaxError: The keyword ‘interface’ is reserved (23:0)
so I need to do a tricky module import like this to remove all warning and error from both side
if (process.env.BROWSER) { // wepback
JsonObject = require('typedjson/src/typed-json.ts').JsonObject;
JsonMember = require('typedjson/src/typed-json.ts').JsonMember;
}else { // Node with ts-node/register
JsonObject = require('typedjson').JsonObject;
JsonMember = require('typedjson').JsonMember;
}
Any idea for this problem ?
Thank for help !
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)

Top Related StackOverflow Question
@JohnWhiteTB
Thanks for response! I just found way to fix this issues !!
for any Webpack build stream it need to exclude importing unnecessary files from bundling by adding External options like this
I’m still seeing this warning. I have tried to configure webpack and TypeScript to work with CommonJS as suggested, but that didn’t seem to help. Any other idea is appreciated.
There is one thing I don’t quite understand: why is webpack trying to load
.../typedjson/js/index.d.tsat all? This should be something exclusively handled on the TypeScript side, shouldn’t it? (Intypings.jsonI have"typedjson": "npm:typedjson"as a dependency.)Edit: the issue seems to be reopened in https://github.com/JohnWhiteTB/TypedJSON/issues/32.