Replies: 22 comments 1 reply
-
This experimental setup might do it: |
Beta Was this translation helpful? Give feedback.
-
@dougal83 Thank you for providing the example repository combines LoopBack 4 and Angular. |
Beta Was this translation helpful? Give feedback.
-
@yakirbu Use this https://www.npmjs.com/package/tsc-watch |
Beta Was this translation helpful? Give feedback.
-
Related to: #2107 |
Beta Was this translation helpful? Give feedback.
-
@gregra81, thanks for your information. I've tried your suggestion above, however, I got an error saying: @jannyHou, it's a good idea to get the inventory of the examples. @bschrammIBM suggested in #2087 that we should make the distinction between examples and tutorials, i.e.
To expand that work, I think we can create a section there. |
Beta Was this translation helpful? Give feedback.
-
I have gotten quite a long way down the nodemon + ts-node route. If you go down this route you will run into a few thing, first you have to create a point of entry file for ts-node because index.ts is some sort of bundling file and not a Typescript version of index.js. import * as application from './src';
module.exports = application;
const config = {
rest: {
port: +process.env.PORT || 3000,
host: process.env.HOST || 'localhost',
openApiSpec: {
setServersFromRequest: true,
},
},
};
application.main(config).catch(err => {
console.error('Cannot start the application.', err);
process.exit(1);
}); Then your nodemon configuration to package.json "nodemonConfig": {
"watch": [
"src"
],
"ext": "ts",
"exec": "ts-node nodemon.ts"
}, Then you have to add the typescript controller files into your
I now am getting a:
Which is a bit slow but fine for now. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
It's not my code, perhaps you can ask @mightytyphoon who originally posted the example #1818 |
Beta Was this translation helpful? Give feedback.
-
@gregra81 So after digging into tsc-watch and tsc itself, it ends up with a better version. |
Beta Was this translation helpful? Give feedback.
-
@dhmlau @yakirbu It automatically detect any source-code changes and restart the server as well. |
Beta Was this translation helpful? Give feedback.
-
for the record: if u want to debug ur app and have proper sourcemap support. Use: |
Beta Was this translation helpful? Give feedback.
-
Thanks, it works, but hopefully there is still another simple way, so our source code not fully of *.js.map file. |
Beta Was this translation helpful? Give feedback.
-
So, who can explain or who can show example about how I can used nodemon with Loopback 4. How I can changed files and take autorestart my loopback server? |
Beta Was this translation helpful? Give feedback.
-
Add
to your package.json Then simply run nodemon (assuming you've already installed it) |
Beta Was this translation helpful? Give feedback.
-
@anjorinjnr What start file I need to run in nodemon command? |
Beta Was this translation helpful? Give feedback.
-
Ok, work for me this option: "scripts": { and added this to package.json: "nodemonConfig": { And run application by this command: |
Beta Was this translation helpful? Give feedback.
-
It works for me too. Thanks |
Beta Was this translation helpful? Give feedback.
-
this solution works with modify package.json: "scripts": {
"build:watch": "lb-tsc es2017 --outDir dist --watch",
"start:dev": "nodemon --watch ./dist --inspect ./index.js"
} modify tsconfig.json: {
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "src",
"sourceMap": false,
"inlineSourceMap": true,
"inlineSources": true
},
"include": ["src"]
} u will have to run both |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I think it would be best for adoption if loopback came with something that handled this out of the box. Installing the framework thinking you can start coding right away, then having to deal with this problem isn't a great experience.
|
Beta Was this translation helpful? Give feedback.
-
I though of using Turbo repo along with the nodemon solution the basic idea is to run build watch and restart the server using nodemon I have posted a solution on stackoverflow so other can also give some feeback Thanks hope its helps someone |
Beta Was this translation helpful? Give feedback.
-
I didn't want to introduce
Then, add this to your
Would be great to have that out-of-the-box 😬 ! |
Beta Was this translation helpful? Give feedback.
-
Hi,
If I would like loopback to automatically refresh after changes, how can I do that?
running 'nodemon start' doesn't seem to work, it runs the server, but doesn't restart upon changes.
(.P.S, is there a substitute to 'lb property', for loopback 4, to add a new property to a model?)
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions