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
{{ message }}
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
I have a large project which I would like to convert to TS over time. Webpack seems able build the client just fine, but I have problems with getting the server running in development mode. Babel-register seems to dislike import-ing a typescript file. It cannot find the import unless I add the .ts extension. If I add the .ts extension it interprets the file as JS, it never gets transpiled by TS and crashes.
Here is a link explaining how typescript and babel work together in webpack.
Is there a way to get around using babel-register in development?
Typescript works for server and client code in both dev and production and source maps work fine too.
Test are probably broken also the solution might not be the best:
ts(x) files are transformed with tsc, output path is the build directory
client code is processed by webpack, server code is picked up by Meteor
btw: the meteor package meteortypescript:compiler is not used nor required - its a leftover I forgot to remove in the repo and just spotted.
@JBBr Thanks! I took a different approach and just used webpack without tsc. I disabled babel register, configured webpack to output to build/server.js, changed index.js to require(buildDir + '/server.js'), then added the following to start.js
This lets webpack watch the server directory and rebuild the server on any changes. The output of the build is picked up by smart restart at build/server.js and the server is restarted. This seems to be working well for me so far.
It would be interesting how your setup performs in bigger projects. As far as I know Meteor does some caching when building its modules.
When letting the Meteor builder handle a huge bundle performance might be worse compared to small but cacheable modules.
I haven't done any benchmarks yet so there might be no performance impact for meteor server modules in this case. Not sure about this.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have a large project which I would like to convert to TS over time. Webpack seems able build the client just fine, but I have problems with getting the server running in development mode. Babel-register seems to dislike import-ing a typescript file. It cannot find the import unless I add the .ts extension. If I add the .ts extension it interprets the file as JS, it never gets transpiled by TS and crashes.
Here is a link explaining how typescript and babel work together in webpack.
Is there a way to get around using babel-register in development?
Relevant section of loader config
The text was updated successfully, but these errors were encountered: