Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

node.js - firebase功能中的“ firebase服务”未运行最新更改(“firebase serve” in firebase functions is not running the latest changes)

I am playing with firebase functions.

(我正在使用Firebase函数。)

Works fine when deploying to firebase server using command firebase deploy --only functions .

(使用命令firebase deploy --only functions部署到firebase deploy --only functions服务器时,工作正常。)

However, I would like to test my functions locally before deploy to server of course.

(但是,我当然想在部署到服务器之前在本地测试我的功能。)

What I see running firebase serve is that the functions "deployed" locally have not the latest changes I did in indext.ts - are running the last builded version, which are in index.js.

(我看到运行firebase服务的是,在本地“部署”的功能没有我在indext.ts中所做的最新更改-正在运行上次构建的版本,即index.js中的版本。)

My question is, How do I manual build my firebase functions project to test them locally with latest changes?

(我的问题是,如何手动构建Firebase函数项目以使用最新更改在本地对其进行测试?)

Should firebase serve autobuild the project before deploy it locally?

(如果firebase serve自动构建项目之前在本地部署呢?)

For me, it sounds like a bug.

(对我来说,这听起来像个虫子。)

  ask by lordneru translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to reload the changes to your TypeScript when running firebase serve or firebase functions:shell , all you have to do is build your project again using npm script that was created for you when you initialized the project (see package.json):

(如果要在运行firebase servefirebase functions:shell时将更改重新加载到TypeScript中,您要做的就是使用初始化项目时为您创建的npm脚本再次构建项目(请参阅package.json):)

cd functions
npm run build

This will transpile your TypeScript to JavaScript, and the changes to the JavaScript will get picked up by the emulator automatically.

(这会将您的TypeScript转换为JavaScript,并且仿真器会自动提取对JavaScript的更改。)

Also, if you are a more advanced TypeScript user, you can run tsc --watch to automatically compile TS to JS when source files change on disk.

(另外,如果您是TypeScript的高级用户,则可以在源文件在磁盘上更改时运行tsc --watch自动将TS编译为JS。)

You can read more about that in this blog .

(您可以在此博客中了解有关内容的更多信息。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...