-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Node guide #6
Comments
What kind of things would you want in the Node guide? |
So this could be used to build a CLI tool (it will preserve shebangs) or even a lambda function. Probably want to just show off adding @types/node maybe? |
And you'll want |
@jaredpalmer I'd love to use tsdx to compile code for Lambda's, but think I'm missing something in that a I have a simple tsdx project here with 2 dependencies, but neither ( What am I missing to allow these dependencies to be in the build files so I could use this in a Lambda? |
Found the answer in that UMD was disabled by default -- e81f5a6 |
Thought I found the answer, but even producing a UMD build does not bundle the dependencies. I took a look at the rollup config and feel like it should work, but not certain what I'm missing. Any help is appreciated. |
@kevinold did you ever figure this out? just came to |
@cogell I did not find a solution |
So I just dug into this because I also wanted to start using this for building lambda functions. I was able to initially make simple code, but as soon as you add dependencies it gets complicated. There's a few limitations with the current implementation that make this difficult - namely around the rollup configuration. Currently
Both of these become an issue for this use case. Firstly we need all external dependencies bundled. Secondly a number of our bundles are probably not written in es6 and we'll need this conversion. My work around is fairly simple, but there's potential implications I don't currently full understand: Create a const commonjs = require('@rollup/plugin-commonjs');
module.exports = {
rollup(config) {
// Delete the external config property.
// This essentially means we're allowing all packages to be bundled.
delete config.external;
// Manually use the commonjs plugin.
// This is opposed to specifying umd as the format as there's more implications that, again, are unclear.
config.plugins.push(commonjs());
return config;
},
}; You can then call
I want to either update the docs with this in mind, or completely rethink how this is handled using the guided installation. The latter would be a lot of work, but I think the benefits would be great. I hope I covered everything I found, as I've been fighting this for a few hours. |
@lpolito I looked into the warnings, and I'm pretty sure the ones you're getting are for Node built-ins ( RE: UMD vs. CJS, I think you should be fine using UMD as it works for Node too (it is "universal"). I'm not 100% sure how it imports built-ins, but IIRC UMD will use the |
No description provided.
The text was updated successfully, but these errors were encountered: