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 Sep 25, 2019. It is now read-only.
In my continuous efforts of applying Sagui to any javascript development problem that pops up, I've now found a use case that may be interesting.
I'm building a small side project, with the backend built on serverless (AWS Lambda). The frontend is built with Sagui as usual.
My plan was to have 2 separate folders (I think a shared sagui.config.js would be too complex), and have 1 shared directory flow-lib where I can put type definitions that would be shared between the 2 projects. This to have static type checking for the API calls between front- and backend. This means that both front- and backend will contain flow type definitions, and reference the shared type definitions.
AWS Lambda does not speak flow-types. It only speaks node 6.10+. So, I wanted to look into the possibility of Sagui building with target: 'node' (and libraryTarget 'commonjs2'). I tried building the backend as a "library", which works but obviously generates a lot of nonsense in terms of webpack-preamble in the top of the output. My motivation for using Sagui also for the backend, is that most of the Sagui tools are useful there as well (linting/prettier, stripping flow-types, minification, etc).
This is the conceptual project structure, where backend/src may contain a number of files (function1.js, function2.js) that will be transpiled to backend/dist and then uploaded to AWS Lambda:
I'm still not entirely sure what target: 'node' would entail for the rest of the sagui-tasks (like test for instance), I've only pondered a little bit on build and dist.
TL;DR: supporting target: 'node', good/bad/idk? I can try and hack together a POC if you'd be interested.
The text was updated successfully, but these errors were encountered:
cskeppstedt
changed the title
Support for target: 'node'
Add support for target: 'node'?
Jun 8, 2017
cskeppstedt
changed the title
Add support for target: 'node'?
Add support for target: 'node'?
Jun 8, 2017
Well, given that we are seriously considering adding Jest alongside Karma in v10, that would be a solution for the testing problem. And in general, I have indeed been using Sagui for more than just frontend projects, so I understand the motivation.
Although, as you point out, I don’t know exactly what it would entail, I think targeting node makes sense.
Don’t know if Webpack has a "target: node" option, which is a possibility.
It should, there's an example in the docs. According to this example, the possible targets are ['web', 'webworker', 'node', 'async-node', 'node-webkit', 'electron-main'].
And yeah, using jest would be awesome. I used it on a nodejs project recently and it's just a breeze to do TDD with it :)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In my continuous efforts of applying Sagui to any javascript development problem that pops up, I've now found a use case that may be interesting.
I'm building a small side project, with the backend built on serverless (AWS Lambda). The frontend is built with Sagui as usual.
My plan was to have 2 separate folders (I think a shared sagui.config.js would be too complex), and have 1 shared directory
flow-lib
where I can put type definitions that would be shared between the 2 projects. This to have static type checking for the API calls between front- and backend. This means that both front- and backend will contain flow type definitions, and reference the shared type definitions.AWS Lambda does not speak flow-types. It only speaks node 6.10+. So, I wanted to look into the possibility of Sagui building with
target: 'node'
(and libraryTarget 'commonjs2'). I tried building the backend as a "library", which works but obviously generates a lot of nonsense in terms of webpack-preamble in the top of the output. My motivation for using Sagui also for the backend, is that most of the Sagui tools are useful there as well (linting/prettier, stripping flow-types, minification, etc).This is the conceptual project structure, where backend/src may contain a number of files (function1.js, function2.js) that will be transpiled to backend/dist and then uploaded to AWS Lambda:
I'm still not entirely sure what
target: 'node'
would entail for the rest of the sagui-tasks (liketest
for instance), I've only pondered a little bit onbuild
anddist
.TL;DR: supporting
target: 'node'
, good/bad/idk? I can try and hack together a POC if you'd be interested.The text was updated successfully, but these errors were encountered: